Skip to main content
Participating Frequently
October 26, 2020
해결됨

Is there a way to automate clean keyframe bounces (in scale) to audio?

  • October 26, 2020
  • 3 답변들
  • 3377 조회

Hi!

 

Will try to be as specific as possible. Looking for a way to make a png bounce in scale to an audio kickfile (asin, an isolated 'kick' drum from an audio track). My process:-

 

+ Create audio amplitude of mp3

+ Delete right/left channels (use both channels)

+ Alt-click 'scale' of PNG and pickwhip it to audio slider --> change temp scale expression to [100,100] or whatever the % of scale I am using

+ Add motion blur to bouncing file

 

Now I have a bounce, but even though I am using a clean kick-audiotrack the keyframes are erratic. I proceed by cleaning it up by replacing the biggest values with a smaller number and deleting the other keyframes except for the '0's. 

Now I have what I need: a clean bounce to the kick! Thing is, this takes me so much longer than it should. I am looking for a way to automate it nice and crisp and am willing to pay for a plugin if needed. Suggestions?

 

Thanks a million in advance 🙂

이 주제는 답변이 닫혔습니다.
최고의 답변: Mathias Moehl

Scale  should work exactly as position, exceptthat you want to probably scale in both x and y. So this should animate the scale from 100% to 400% whenever the audio amplitude goes from 2 to 35. Just play with the numbers to get the desired effect (or use my extension BeatEdit for more detailed control).

 

t = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
v = linear(t, 2, 35, 100, 400);
[v, v]

 

3 답변

Mathias Moehl
Community Expert
Community Expert
October 28, 2020

Did you try my BeatEdit for After Effects?

Just use the scale pulse preset of its Beat Wiggle.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Mathias Moehl
Community Expert
Community Expert
October 28, 2020

Here is a more in-depth version of the tutorial

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Community Expert
October 26, 2020

You can do that without any scripts. Here's the workflow.

  • Create a new comp
  • Add an audio file to the comp
  • Select the Audio layer and use the Animation/Keyframe Assistant/Convert Audio to Keyframes menu
  • Select the new Audio Amplitude layer and press "u" to reveal the keyframes
  • Both channels slider is almost always the best choice, select that string of keyframes, open the graph editor and make sure that it is set to view the Value graph and not the speed graph by right-clicking in the Graph editor
  • Scan the graph and determine where you want the movement to start and where you want the movement to reach its maimum value and make note of the numbers (usually between 0 and about 35)
  • Add the layer you want to move and reveal the position property by pressing 'p'
  • Alt/Option + Click to start an expression and then type t = and drag the pickwhip to the Both Channels Slider then add a semicolon to the end of the line and press return;
  • Complete your expression typing y = and then, using the linear method from the expression language menu in the timeline to generate this line of code: linear(t, tMin, tMax, value1, value2);
  • tMin is the minimum value you made note of when you looked at the graph editor, tMax is the maximum value, value 1 is the resting position which should be zero, value2 is the maximum movement in the Y-axis so it could be something like 200
  • After you complete the second line of the expression create this array for the last line: [value[0], value[1] - y];

The array takes the current value for X and then subtracts the calculated value of Y from the current value of Y to move the layer up every time the sound passes the threshold. The complete expression would look like this if your audio values were 2 and 35 and you wanted the layer to move up 400 pixels when the sound was the loudest:

t = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
y = linear(t, 2, 35, 0, 400);
[value[0], value[1] - y]

This is what the screenshots would look like:

That will get you there in about 5 minutes. You can also use ease instead of linear in the second line of the expression. 

N5FDC작성자
Participating Frequently
October 27, 2020

It appears this may do the trick 🙂 Am going to get cracking on it today. Thanks a million Rick Gerald for your time and input, you're a legend!

Mylenium
Legend
October 26, 2020

Entirely depends on what you're after, but most likely you are looking for something like this

 

http://www.motionscript.com/design-guide/audio-trigger.html

 

rather than feeding the animation directly from a source. Other options of course could include things like using the smooth() expression functions to even out things or any number of other things. You would have to be more specific about what you actually are trying to do.

 

Mylenium

N5FDC작성자
Participating Frequently
October 26, 2020

Mylenium,

 

Cool! I'm a junior when it comes to scripts but will have a long hard look at http://www.motionscript.com/design-guide/audio-trigger.html - thanks again 🙂

 

I am basically trying to make a music video clip with one layer (png) reacting to the beat of the music. There's some audio programs, like Fruity Loops, that have a visual work station in which you can automate certain image files you upload to particular music channels (kick, bass, etc). I'm trying to do the same but in After Effects - but of course AE is much, much more complicated than the very simplistic visualisers in programs like Fruity Loops. Thing is: the visualiser in Fruity Loops takes 5 seconds to make a really neat, tight, bounce to whatever part of the music you want. I haven't found a way to automate it in AE without taking at least an hour per project to clean up the keyframes, but like I said I'm a noob to scripting..

 

Cheers.

N5FDC작성자
Participating Frequently
October 26, 2020

.... and the 'smooth expression' function may do the trick as well