• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Make music reactive elements more extreme

Contributor ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Im using an audio amplitude layer so that I can create music-reactive graphics.

I've used the following code on one of my elements to reset the scale to 100% while it is animating:

temp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"); [temp, temp] + [100,100]

But I'd like it to be more extreme.

If I simply add '*2' at the end of the code, it also amplifies the lower end of the scale, meaning the whole thing is bigger.

Id like it so that there is more contrast between the lower and upper ends of the scale... if that makes sense.

TOPICS
Error or problem , Expressions , How to , Scripting

Views

651

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 06, 2023 Mar 06, 2023

Creating reactions to the Audio Levels keyframes is best handled by deciding what range of values you want to work with and then converting the Audio Levels keyframe values to fill the range of values you want as the last result. A linear interpolation method is usually the place you want to start.

 

If the range of your Audio Levels keyframes if from 0 to 18, and you want to change another value from 20 to 200, and you want the reaction to the changing values to start at 2 and reach the maximum

...

Votes

Translate

Translate
Contributor ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Figured it out:

temp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
[temp*5, temp*5] +[100,100]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Oh, yes, that's effectively the same as the solution I suggested. My solution is a bit more lengthy, but has the advantage that you only need to change one number instead of two.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

You need to multiply the temp only:

temp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"); 
temp = temp * 2; // here we make temp twice as big.
[temp, temp] + [100,100]

 

Also note that BeatEdit for Ae is a very powerful tool for animating elements in sync with music - see here what its beat wiggle can do, for example:

 

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

Thank you! i've realised however that the temp variable doesn't appear to show when using a rotation property?

thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

LATEST

Creating reactions to the Audio Levels keyframes is best handled by deciding what range of values you want to work with and then converting the Audio Levels keyframe values to fill the range of values you want as the last result. A linear interpolation method is usually the place you want to start.

 

If the range of your Audio Levels keyframes if from 0 to 18, and you want to change another value from 20 to 200, and you want the reaction to the changing values to start at 2 and reach the maximum at 6, the expression to do that would look like this:

 

 

t = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
v = linear(t, 2, 18, 20, 200);
[v, v]

 

 

The output will be 20 until the audio amplitude reaches 2, then it will expand in a linear method to 200 when the audio amplitude reaches 6 and never go higher than 200. The linear method looks like this: linear (t, tMin, tMax, value1, value2)

 

If you want a more exponential expansion of the values, you can do a little math and multiply the value by some power. You just have to work backward from the maximum ending result. For example, if you still wanted the maximum value to be 200 but you wanted exponential scaling, then the square root of 200 would be the value2 maximum value. The new expression would look like this:

 

 

t = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
v = linear(t, 2, 18, 1, 14.1421356237);
nV = Math.pow(v, 2);

 

You don't need the array if you apply the value to rotation. You can also change the exponent in Math.Pow(v, 2) to 1.2 or some other value to get the results you want.

RickGerard_0-1678122072486.gif

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines