How To Make Your Animation React to Music in After Effects

waveform
A neat waveform.

 So you want a piece of animation to react to your thumpin' beats of the latest techno dance drop? Who doesn't! Let's take a look at how to make that happen using Adobe After Effects, so pop that open or download your free trial and let's dive right in!

So first let's spend a quick second talking about what kind of animation works with this effect. Generally speaking it's gonna be more abstract, trippy styles that will respond well to this technique.

This won't be a great method to get a character to dance around the screen to the music, but if you want a pulsating light or cool techno ring this is the place to be.

Now once we've started up After Effects let's find a piece of music to work off of. I'm going to be using Welcome Home (Sanitarium) by Metallica, but you can use whatever you'd like. Free Music Archive is a good resource as well if you're looking for a piece of music to use in a video you're going to end up publishing to Youtube if you want to avoid it being taken down. Also music that has big hits and bass is usually a better way to go for this effect than something more mellow, so keep that in mind, as well as songs without lyrics tend to work better as well. After Effects loses a lot of the variation in the song when dealing with lyrics, but for our example I'm going to be using the great intro to Metallica so it'll work fine.

Once we've imported our piece of music into After Effects, let's drag it down to the New Composition icon in the bottom of our Project Window to create a composition that is the length of our song.

Next let's make a simple square solid to work with. I know it's not a cool techno ring, but we'll apply our effect to it's scaling so that it grows and shrinks with the music.

The effect we're going to do can be applied to anything, so we'll just keep it simple with the scaling here for sake of example, you can apply it to your cool techno style later on your own once we've understood how it works.

Now that we have that set up, let's add an effect to our audio so that we can exaggerate the song even more to try to get better results from the effect. We'll apply the Bass & Treble effect to it, and depending on which we'd like our animation to respond more to we'll crank it up and the other down. So if we want our animation to respond more to the bass beats, we can crank it up to 100 and treble down to -100, and vice versa if we want it to respond to the treble of the song. For our example I'll amplify the treble.

Next we'll want to turn our audio into keyframes and that is super easy. Just right click on our audio track down in our Timeline and select Keyframe Assistant and then choose Convert Audio To Keyframes. You'll see a new null object appear named Audio Amplitude, and this is where all of the keyframes that were adapted from our audio live. If you select our new null object in our timeline and hit U you'll bring up all the attributes and their keyframes.

You'll see we have 3 attributes, Left Channel, Right Channel, and Both Channels. As I'm sure you've guessed these are what plays out of the left speaker, the right speaker, and both speakers. I'm going to go off of both channels to keep things simple, and to keep myself organized I'll select Left and Right Channels and delete them form our null object.

The channels have a slider within them, and if we scrub through our timeline you should see the numbers of the slider change throughout the song but our null object doesn't change at all. That's because sliders are a lot like a null object, they have values but don't effect whatever they are directly attached to usually. We can use that to attach another attribute to that slider, and have it respond to what the slider is doing.

Now you'll see that the slider is only changing a little bit, mine is hovering around 10 to 20.

If we use that our effect will be very subtle, almost too subtle to make it worth it. So let's go in and magnify this value so that our effect is more dramatic and exaggerated for our animation.

We're going to do that using an After Effects expression. An expression is a little equation that acts as a piece of code telling After Effects to do something specific. In this case, we're going to tell it to magnify the values of this slider. So first here's the expression you'll need to type in:

linear(value,a,b,x,y)

What that means is that it will change the values of our slider so that if the value is A, it will become X, and if the value is B, it will become Y. So for example if our expression looks like this: linear(value,0,50,10,100) that is saying that when the value is 0, it will be changed to 10 and when the value is 50 it will be changed to 100.

So now we want to find out what the values for our individual piece of music will be for our expressions. Select your slider and open up the Graph Editor by clicking the graph button on your timeline. This brings up a crazy looking line graph, and we'll want to find out what some of our average values are.

First let's find out our low average by looking at the where the lowest dots on our graph are. Mine are around 7. That means we'll want to change our A value to be 7, and the X value to be whatever we would like our new lowest value to be, I'll make mine 50.

Now we need our average high value, so look at where the most dots at the peak of the line graph appear and guesstimate the value.

Mine is at around 35 we'll say, we don't have to be super exact and we can always go in and tweak things later.

I'll put 35 in for B and we'll make our Y into 200. So we're saying that our average high value of 35 will become a value of 200 instead.

Now if we scroll through our timeline you should see a much more dramatic shift in the values on our slider. That's exactly what we want to have happening.

So now let's make our solid pulse to the music with these new exaggerated values. I'll click my solid in my timeline and hit S to bring up it's scale, and then I'll Option or Alt click the stop watch to bring up the expression control. Here I'll use the Pick Whip, which is the icon that is a little spiral line, to click and drag from the Scale expression onto the Slider in our Audio Amplitude layer.

This will add a new long expression into our solid's size expression window, you could type this all out but it's much easier to use the Pick Whip. What this expression is saying is that you want After Effects to match the scale of our solid to the value of the slider in our Audio Amplitude layer.

Now if we play our animation, you should see your solid changing size in relationship to your music. Ta da!

Odds are it's not reacting exactly how you want it to, this is where you'll probably have to go in and refine the values in your expression so that it makes the animation react a little bit more of how you'd want it to react.

Now that is the same way we can apply music affecting any other element within After Effects.

It can control glow, lens flare brightness, position, rotation, blur, you name it, all by doing the same process and simply pick whipping whatever effect you'd like to react to the Audio Amplitude channel slider. So have fun and go crazy!

Format
mla apa chicago
Your Citation
Chew, Johnny. "How To Make Your Animation React to Music in After Effects." ThoughtCo, Apr. 27, 2016, thoughtco.com/animation-reacts-to-music-after-effects-4037511. Chew, Johnny. (2016, April 27). How To Make Your Animation React to Music in After Effects. Retrieved from https://www.thoughtco.com/animation-reacts-to-music-after-effects-4037511 Chew, Johnny. "How To Make Your Animation React to Music in After Effects." ThoughtCo. https://www.thoughtco.com/animation-reacts-to-music-after-effects-4037511 (accessed November 20, 2017).