Skip to main content
Inspiring
August 6, 2022
Question

Possible to use two audio amplitudes for one effect value?

  • August 6, 2022
  • 2 replies
  • 216 views

Hello,

i know how to match for example the position value to an audiofile by converting it to keyframes.

But is it possible instead of using only one audio amplitude to use two of them?

For example, i have an element centered in my scene and relative to the first audio volume it moves to the right and relative to the second one it moves to the left.

Is it possible to handle smth like that?

 

many thanks

This topic has been closed for replies.

2 replies

Community Expert
August 6, 2022

Create your two Audio Amplitude layers, pick a channel for both and delete the others. I usually use Both Channels. Open the Graph Editor and look at the Value Graph to determine the minimum and maximum values you want to use to drive the animation. Make a note of those values.

 

Now you add an expression to the position property that uses the linear or ease interpolation method. 

 

The ease interpolation operator looks like this:

 

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

 

Open the graph editor to determine what values you want to use for your minimum trigger to start the move (tMin) and maximum threshold (tMax), and make note of both values. Value1 and value2 will be the minimum and the maximum number of pixels you want to move the layer.

 

Declare a tR and a tL variable by pointing at the appropriate sliders. create a rt and lft variable using the appropriate interpolation operator and fill in the numbers for tMin, tMax, value1, and value2. 

 

The last step is to add your tR and tL value to the current x position and read the current y position. The expression would look like this:

 

tR = thisComp.layer("Right Audio Amplitude").effect("Both Channels")("Slider");
tL = thisComp.layer("Left Audio Amplitude").effect("Both Channels")("Slider");
rt = ease(tR, 2.5, 6, 0, 500);
lft = ease(tL, 2.1, 6.5, 0, - 500);
[value[0] + rt + lft, value[1]]

 

That should do it.

 

One more thing. When you convert your Audio to Keyframes, make sure that you solo the layer so the conversion does not get contaminated by other layers.

 

 

Inspiring
August 7, 2022

Hello,

many thanks for the detailed description, i will try this 🙂

Mylenium
Legend
August 6, 2022

Sure, you just need to combine the values in your expression. Likely you may want to normalize them in some form as well. The basic formula for that is 1/Math.sqrt(A+B)*multiplier in generic pseudo code where a and b would be the references to the audio inputs and the multiplier would be the amplitude by how much it should move. As an alternative you could mix the audio files in a pre-composition with an channel mixer effect or just by adjusting and animating the audio levels and reference that inside a linear(amplitude,minimum,maximum,-offeset,offset) style expression as well. Really depends. More specific info certainly would help to outfit you with a suitable expression.

 

Mylenium