Set up the comp by:
1) Convert the Audio to key frames
2) select the layer you want to toggle on and off
3) open the opacity — “T” Key
4) Alt click the stopwatch (PC assumed here)
5) drag the pick whip to the audio slider
AE will generate an expression for you like:
thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”)
We want to change this so that we can modify the value before it gets passed to the opacity. What we need to do is:
1) assign a variable to the audio levels
2) assign a variable to the opacity level
3) set a lower limit value below which the opacity is zero and above which the opacity is set to 100.
So now the expression looks like this:
signal_value = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);
if (signal_value < 25 ) {
opacity_value = 0;
} else {
opacity_value = 100;
};
opacity_value;
The logic is intuitively obvious to the most casual observer -- but I will walk you through just in case:
The conditional statement of the expression constantly checks the value of the variable "signal_value." If the value of variable "signal_value" is less than 25, then the expression path flows to the statement immediately below where the variable opacity_value is set to zero. If, however, the value of the variable "signal_value" is 25 or greater, then the expression path jumps to the statement immediately below the "else" where the variable opacity_value is set to 100.
Finally, the last line "returns" or announces the opacity_value to the layer.
HTH
Mark Cain
Sarasota, FL USA