Activity › Forums › Adobe After Effects Expressions › reacting to Audio with Falloff
-
reacting to Audio with Falloff
Posted by Bert Brown on February 7, 2008 at 4:21 pmI have these squares that i have jumping up to a beat, but I want them to have falloff instead of just shooting right back down when the audio level is at zero.
How do i do this?
———————————-
“hand me my patching trowel, boy!”
peep my over-the-interweb band, redabbott.
“we electro-rock over long distances…”
Bert Brown replied 18 years, 3 months ago 2 Members · 6 Replies -
6 Replies
-
Dan Ebberts
February 7, 2008 at 5:52 pmPlay around with this, it might get you started. It assumes that you converted your audio to keyframes. It should cause your layer to jump vertically from wherever you position it. “amp” adjusts the jump amplitude and “falloff” adjusts the falloff speed. It will bog down if your comp gets too long.
aud = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);
falloff = 1;
amp = 5;val = 0;
t = 0;
while (t <= time){ val = Math.max(aud.valueAtTime(t), val - falloff); t += thisComp.frameDuration; } value - [0, val*amp] Dan -
Bert Brown
February 7, 2008 at 6:53 pmWhoa, thanks Dan! You rock and roll.
I’m trying to break down and understand what you did here (because i wouldn’t be learning by just copying, would I?) and I understand, for the most part, what’s going on, but I’m unsure of what “thisComp.frameDuration” is representing. ???
———————————-
“hand me my patching trowel, boy!”
peep my over-the-interweb band, redabbott.
“we electro-rock over long distances…”
-
Dan Ebberts
February 7, 2008 at 7:43 pmIt’s just the duration of one frame, in seconds. At each frame, the expression starts at time zero and looks at the audio value for each previous frame. This is necessary because expressions can’t retain data from one frame to the next so in a situation like this where you need to know what happened in the past, your expression has to essentially recreate the past.
Dan
-
Bert Brown
February 8, 2008 at 7:20 pmOk, now I have sort of the opposite or inverse question.
What if I want the layer, when it’s born, to jump to the audio value (say in scale) but then not retreat down. Maybe the jump is 2 frames and then it just lives at that height.
-
Dan Ebberts
February 9, 2008 at 12:45 amI’m not sure exactly what you’re after here, but this might be close:
aud = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);
amp = 1;val = 0;
t = 0;
while (t <= time){ val = Math.max(aud.valueAtTime(t), val); t += thisComp.frameDuration; } value + [1, 1]*val*amp It will scale up at the largest amplitude and hold that value (unless a larger one comes along). Dan -
Bert Brown
February 13, 2008 at 4:02 pmthat’s perfect. thanks again!
———————————-
“hand me my patching trowel, boy!”
peep my over-the-interweb band, redabbott.
“we electro-rock over long distances…”
Reply to this Discussion! Login or Sign Up