Activity › Forums › Adobe After Effects Expressions › adding falloff to an expression
-
adding falloff to an expression
Posted by Michael Duff on July 17, 2007 at 12:06 amhi guys … just wondering if there is a way to add some fall off the an audio expression … i know that soundkeys does it, but we don’t have it …
any advice would be great
cheers
Michael Duff replied 18 years, 9 months ago 2 Members · 4 Replies -
4 Replies
-
Dan Ebberts
July 17, 2007 at 12:59 pmPlay around with this:
decayTime = 1; // decay time (seconds)
mult = 5;
audLev = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);k = 4.605/decayTime;
currFrame = Math.round(time/thisComp.frameDuration);
decayFrames = Math.round(decayTime/thisComp.frameDuration);
sampleFrame = Math.max(0, currFrame – decayFrames);
decayTime = 0;
curMax = 0;while (sampleFrame <= currFrame){ sampleVal = audLev.valueAtTime(sampleFrame * thisComp.frameDuration) * mult; curVal = curMax/ Math.exp(decayTime * k); if (sampleVal >= curVal){
curMax = sampleVal;
decayTime = 0;
}else{
decayTime += thisComp.frameDuration;
}
sampleFrame++;
}
curValDan
-
Michael Duff
July 18, 2007 at 2:29 amthanks Dan! I’ll study through that when I have a big coffee ….. in the meantime I have another, hopefully much simpler, question …
i just want to grab the Y-position of a layer but at a different point in time .. so something like transform.position[1].valueAtTime(time-1)
does that makes sense?
thanks!
-
Dan Ebberts
July 18, 2007 at 2:57 amSure, but it would be like this:
transform.position.valueAtTime(time-1)[1]
Dan
Reply to this Discussion! Login or Sign Up