Expression needed?

Robbie Comeau

Como's back. back again
I have a light hanging on a wall, and I set up an expression in the Opacity tab:

wiggle(15,25)

This will make it look like the light is old, and its slowly dying, and it's cutting in and out.


I was just going to apply a sound effect and leave...But i want the sound to match the light.

So when the light flickers, I want the sound of a flicker to come in.

Do I need an expression? And If so, where do I apply it? What would I type in?

Thanks.
 
if you want to link the volume of the noise to the opacity of the light, you can create a light flicker/hum/buzz/whatever you want looped or full sound that is as long as the total length of the longest shot(comp) you need the sound for, then just pick whip the value for the volume of the sound layer to the opacity value of your light, edit your created expression you get after using the pickwhip and then pressing enter to look like this

temp = -100 + (100 - thisComp.layer("White Solid 1").transform.opacity) * 7;
[temp, temp]

this is based off of using the wiggle(15,25) expression you have already because using that , if you change your wiggle value to be more than a max of 25 you will need to adjust the end multiplier of this expression accordingly, basically, this expression takes the amount that your light has lost its opacity from the max of 100, and adds that value times 5 to the volume of the noise layer starting at -100. so when the light is at full 100, the sound is at -100, when the light is less than 100, the audio gets raised by that opacity amount less than 100 ..times 7.

things to note are that with a max value of 25 I do realise that a multiplier of 7 will put the volume over 0 to the max of +24 if your light actually hits as low as 75, but its probably not ever going to hit 75 so you need to generate audible audio values with lesser dips in the light opacity. also worth noting is that your wiggling 15 times a second here, so you might as well just make a flickering light audio track and play it all the time because 15 times a sec is at least 15 frames out of 24 or 30 which means its doing it more than 1/2 the time anyway. if you slow your light flicker down this expression will work better, or make your flicker periodic, you can alter this expression so that any value below the normal max opacity for your light will give your audio track full volume to +24 then just add a -24 at the end so your track plays at normal 0 volume whenever the light dips in opacity. youll have to link a few more things (like a slider) to get it right the periodic way as well, but see what you think of this expression first :)


also you might want to try doing it the other (easier) way around, and creating an audio track thats comes in and out, and simply using the (convert audio to keyframes) command, or trapcode soundkeys to generate vaules that you can make your light flicker with based off how loud the flickering sound is, that way you can have your light only dim when your sound plays, and you can have it naturally wiggle off the generated keyframes, or use expressions to wiggle and distort the keyframes beyond what they are straight out of the box.
 
if you want to link the volume of the noise to the opacity of the light, you can create a light flicker/hum/buzz/whatever you want looped or full sound that is as long as the total length of the longest shot(comp) you need the sound for, then ...

Wow.
That's as far as I got before you lost me...
I definitely need to get deeper into AE.
 
Luis its all about parenting

You're going to teach me about parenting??
:)

Just kidding - I gotcha.
I'd never heard the term 'pick whipping' before.
Obviously I'm not an AE guru....
AE is like the grocery store to me, I know what I need to get out of it, and I know where that stuff it, I get in and out as quickly as possible.

I really need to make an effort to actually learn it.
 
creating an audio track thats comes in and out,

What excatly did you mean by that Neil? EVerything else makes sense to me. Thanks for that write up AE is a powerful thing it just blows me away the stuff we can do with it.

Luis that grocery store analogy was funny :).
 
YA i can understand that.

Luis its all about parenting. (pick whipping)

Thanks.


..to be specific though were talking about using the pickwhip to get values from other scources within the expressions paramaters and not within the layers general parenting column.


..and by making an audio track that comes in and out i meant just have the volume go up and down, and then when you use the "convert audio to keyframes or trapcode soundkeys, you can generate keyframes to be used for the light layers opacity based off the volume of the audio. its doing it the other way around which is just easier.


as for expressions in general, the math goes from left to right, and multiplication happens before addition so that ending * 7 in my expression will multiply the linked parameters value BELOW 100 by 7 before adding it to the -100 volume of the audio layer. and of course calculations in parentheses are completed first and the resulting value is then used in the surrounding calculations. im not a math guy at all, but expressions are definitely worth doing a little math for. its pretty simple once you get the hang of mathematically manipulating the values you want.
 
Back
Top