Hey everyone...lurker here. :-D
I've been programming software that generates ambient music for a couple years, and I was thinking about making an installation with it.
Basically, I'm looking for an AVS preset (or even tips) that would simply fade the screen to a color from a black screen when it hears a certain peak level of sound.
I've been searching for something that could do this easily for a long time, and AVS seems like my best option. Funny how something so basic can be so hard to find!
Any help would be greatly appreciated!
-b
Wondering if this exists:
9 posts
Re: Wondering if this exists:
it sounds easy enough, but you'll need to be more specific. what does it do after the colour fades in? what colour do you want and at what volume will trigger it?
Originally posted by benn
Basically, I'm looking for an AVS preset (or even tips) that would simply fade the screen to a color from a black screen when it hears a certain peak level of sound.
it sounds easy enough, but you'll need to be more specific. what does it do after the colour fades in? what colour do you want and at what volume will trigger it?
thanks for the reply!
white would be fine...this should be easily changable i'm sure. i have a bit of noob avs knowledge to sort that out.
the volume of the audio would trigger the brightness, however, i can't seem to work one out that "fades in and out". i could get it to fade out...but it just flashes in. no "fade in" effect. 🙂
white would be fine...this should be easily changable i'm sure. i have a bit of noob avs knowledge to sort that out.
the volume of the audio would trigger the brightness, however, i can't seem to work one out that "fades in and out". i could get it to fade out...but it just flashes in. no "fade in" effect. 🙂
i get what you want i get it now. i'll have a shot when i get home.
okay the preset's too small for me to bother zipping and posting so here's the code.
superscope with the code
x=0;
y=0;
(rect-coords on)
hope thats what you're after
superscope with the code
followed by a movement trans with the code
init//
n=1
frame//
col1=getspec(0.16,0.27,0);
col1=col1*0.9;
col=col*0.9+sin(col1)*0.25
point//
x=0;
y=0;
red=col;
blue=red;
green=red;
x=0;
y=0;
(rect-coords on)
hope thats what you're after
protips(tm):
There are three tasks in your question:
- Detect if the music is above a certain volume (which is what you mean by 'peak level of sound')
- Interpolate from one colour to another
- Fill the screen with that colour
To detect the volume of the music at any particular time it is easiest to take the DC component of the frequency
spectrum, you can do this using getspec(0,0,0) which will take the zero'th bin of the FFT with a width of zero on
the centre (average of left and right) channel. To test it is above a value you can use above(getspec(0,0,0),<value>), so for example to set the value of register 0 to 1 when the music goes above a normalised 'volume' of 0.9 you can use reg00=if(above(getspec(0,0,0),<value>),1,reg00); note that this will set it to 1 and leave it at 1. You can be more clever when detecting volume by taking a rolling average or using a more sophisticated algorithm but this way is simple and effective. Rather than just switching from 0 to 1 you would probably want a register to smoothly transition from 0 to 1, to do this you can have a second variable which tends towards the value of the other variable over time.
Interpolating from one colour to another is a simple case of linear interpolation:
pal1r=128/255; //define your pallete
pal1g=255/255;
pal1b=0/255;
pal2r=0/255;
pal2g=128/255;
pal2b=255/255;
red=pal1r+(pal2r-pal1r)*lvl; //interpolate (lvl is a value from 0-1)
green=pal1g+(pal2g-pal1g)*lvl;
blue=pal1b+(pal2b-pal1b)*lvl;
Filling the screen with this colour is easiest achieved with a superscope and movement. You render a dot of the desired colour in the centre of the screen and use a movement to set ever other pixel equal to that colour. So create a superscope with n=0, x=0, y=0 and red/green/blue equal to your desired colour. Place a movement after it with the user code 'd=0', this means for every pixel, make the pixel colour equal to the pixel at d=0 in radial coordinates (i.e. the very centre of the screen)
Put that all together and you're done
There are three tasks in your question:
- Detect if the music is above a certain volume (which is what you mean by 'peak level of sound')
- Interpolate from one colour to another
- Fill the screen with that colour
To detect the volume of the music at any particular time it is easiest to take the DC component of the frequency
spectrum, you can do this using getspec(0,0,0) which will take the zero'th bin of the FFT with a width of zero on
the centre (average of left and right) channel. To test it is above a value you can use above(getspec(0,0,0),<value>), so for example to set the value of register 0 to 1 when the music goes above a normalised 'volume' of 0.9 you can use reg00=if(above(getspec(0,0,0),<value>),1,reg00); note that this will set it to 1 and leave it at 1. You can be more clever when detecting volume by taking a rolling average or using a more sophisticated algorithm but this way is simple and effective. Rather than just switching from 0 to 1 you would probably want a register to smoothly transition from 0 to 1, to do this you can have a second variable which tends towards the value of the other variable over time.
Interpolating from one colour to another is a simple case of linear interpolation:
pal1r=128/255; //define your pallete
pal1g=255/255;
pal1b=0/255;
pal2r=0/255;
pal2g=128/255;
pal2b=255/255;
red=pal1r+(pal2r-pal1r)*lvl; //interpolate (lvl is a value from 0-1)
green=pal1g+(pal2g-pal1g)*lvl;
blue=pal1b+(pal2b-pal1b)*lvl;
Filling the screen with this colour is easiest achieved with a superscope and movement. You render a dot of the desired colour in the centre of the screen and use a movement to set ever other pixel equal to that colour. So create a superscope with n=0, x=0, y=0 and red/green/blue equal to your desired colour. Place a movement after it with the user code 'd=0', this means for every pixel, make the pixel colour equal to the pixel at d=0 in radial coordinates (i.e. the very centre of the screen)
Put that all together and you're done
@pak-9, just a little correction:
greets, zha
So create a superscope with n=0, x=0, y=0 and red/green/blue equal to your desired colour.I think n has to be at least 1 (well exactly 1 in this case 🙂 ) or nothing will be rendered.
greets, zha
works lovely! thanks so much for your help. now if only there was a stable way to render it to AVI....but that'll be another battle. :-D
Why not just use fraps? 👍