What I'm looking to do is create an expression that will adjust the volume of a bed of music based upon the volume of another layer. So, if the VO starts up, the bed is dropped to 20 of peak. If a second passes without audio, the bed is slowly brought up to 100%. Is this doable?
Re: Automatically change bed volume through expressions? by Dan Ebberts on Jul 30, 2007 at 9:10:59 pm
Interesting idea. This seems to work. You need to convert the VO track to keyframes. Fiddle with the four parameters until you get something you like. The squelch parameter assumes your bed is stereo - just change it to a single number if it's mono.
silenceLevel = 5; // volume level of VO where squelch is removed
silenceTime = 1.0; // length of silence before bed starts to ramp up
rampTime = 0.5; // time to ramp up bed
squelch = [12, 12]; //amount to squelch bed (db)
VO = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"); //VO level
if (silenceLevel > VO.value){
t = time;
while (t > 0 && t > time - (silenceTime + rampTime)){
t -= thisComp.frameDuration;
if (VO.valueAtTime(t) >silenceLevel) break;
}
if (time - t > silenceTime){
linear(time - t, silenceTime, silenceTime + rampTime, value - squelch, value);
}else{
value - squelch;
}
}else{
value - squelch;
}