Skip to main content
Participant
January 10, 2020
Question

Expression dissappears

  • January 10, 2020
  • 3 replies
  • 259 views

I'm trying to have my image sync it's scale with the beat of the audio. Was able to convert to keyframes and pickwhip scale to the slider, but I found it too small a scale. I tried to add 100 to each of the values, but if I hit enter or click away, it just dissappears.

Here's the code I have working successfully;

temp = thisComp. Layer("Audio Amplitude") .effect("Both Channels") ("Slider") ;

[temp, temp]

And I try to add the following: + [100,100] in order to make it larger. What am I doing wrong?

I'm going off a tutorial that doesn't have this issue. Thanks

This topic has been closed for replies.

3 replies

Community Expert
January 10, 2020

Your workflow and your thinking are incorrect. Open up the Graph Editor, make sure that it is set to view the value graph and check the range of values in the audio layer. Typical values for Both channels run from zero to about 50 or 60. It is easiest to see what the value range if you use the Graph Editor but you can also just check the waveform and the keyframe values:

For this audio track, the maximum loudness is 51.933. The average lowest vale is about 9. Once you know what the loudness (both channels) curve looks like you can add a linear method to the expression. You can use any of the different Interpolation methods to set up the relationship between audio and scale. I usually prefer Linear but you can use easeIn or easeOut. This is the proper linear method to use:

 

 

linear(t, tMin, tMax, value1, value2)

 

 

If you set t to the value of the Both Channels Slider and tMin to 9 and tMax to 60 then you can set value1 to the minimum scale and value2 to the maximum scale value. By setting a variable "s" to be equal to the linear method you can then populate the scale array with "s" by simply making [s, s] the last line of the expression. 

 

Let's say my design wants me to scale a layer that looks like a ball so that it looks like it is stretching only in Y to the beat of the music. I want the X scale value to stay at its current value but the Y scale should follow change from 40% to 120%. This is how you would write the expression:

 

t = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
s = linear(t, 9, 60, 40, 120);
[value[0], s]

 

That should get you started. Any of the good tutorials you will find will follow this method. 

 

Participant
January 10, 2020

Roland Kahlenberg
Legend
January 10, 2020

What's the issue if you replace the LAST LINE in the Expression with -

 

[temp,temp] + [100,100]

 

 

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
Roland Kahlenberg
Legend
January 10, 2020

You've done a few things which individually they should work. However, there is no clarity on what your Expression looks like at this moment. You should provide a screengrab of (1) Expression and (2) Timeline with layers and keyframes.

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV