Using audio to control animation
Video: Using audio to control animationOkay, so we're going to have a look at how you can use an audio file to create animation for you. And we're in the Expressions and Scripting project, which is in the Expressions and Scripting folder. If you want to follow along, you can open that and open 04 using Audio Composition. And in here, I have my little character, and you'll see that I've created some animation of him hammering. Now, I've only done a very short piece of animation, okay? And I'm looping that over and over again if I extend the work area. So, you can see the whole thing.
Viewers: in countries Watching now:
In her career as an animator, Angie Taylor has developed some powerful techniques for creating quick but compelling 2D animation, and in this workshop she shares those secrets with you. Learn how to import layered files and paths from Adobe Illustrator into After Effects and how to animate flat vector artwork in both 2D and 3D space, and explore options for outputting your animations. The videos are short, focused, and solution-oriented, and all the project files are included so you can follow along as you go.
- Best practices for importing source files
- Sorting and interpreting footage
- Animating using traditional layer-style animation
- Creating a grouping structure for body parts
- Animating with the Puppet tool
- Creating stop-frame-style animation
- Setting up control layers
- Animating using time remapping
- Exporting files for Flash
- Making movies via the Render Queue
Using audio to control animation
Okay, so we're going to have a look at how you can use an audio file to create animation for you. And we're in the Expressions and Scripting project, which is in the Expressions and Scripting folder. If you want to follow along, you can open that and open 04 using Audio Composition. And in here, I have my little character, and you'll see that I've created some animation of him hammering. Now, I've only done a very short piece of animation, okay? And I'm looping that over and over again if I extend the work area. So, you can see the whole thing.
You'll see I've only done a couple of taps of the hammer. So, what I'm going to do is go into the right arm comp where the animation is taking place. So, double-click the right arm comp, and in there you can see the animation. Now, instead of using painstaking keyframe techniques, what I want to do, I'm going to trim the work area back to there actually, is remove those keyframes. And instead, what I'm going to do is use an Audio layer. This is how it works. Go over to the Project panel and open up the Audio folder. And in there, you should see a couple files called Hammer. Now, one of them's an AIFF file and one of them's a WAV file. I've put both in there just in case you need one over the other. Perhaps on some systems, AIFF won't work, or perhaps on others WAV won't work. So, I've put two alternatives in there so that you have a choice. I'm going to pull that a file into my project and place it the bottom. And if we go back to the beginning and just run preview that you'll see that I have the sound of tapping.
And I'm just going to extend the work here to encompass that and preview again. Okay, I've literally just recorded this by (SOUND) tapping the table. And what I'm going to do is use that to control the rotation of his arm. So I select the Audio layer and go to Animation > keyframe Assistant > Convert Audio to Keyframes, and that will convert the audio to keyframes. And it creates a null object. And if I hit U with that selected, you'll see it creates keyframes for the left channel and the right channel, because it's stereo, and also both channels. Now, we don't need the left channel and right channel. So, I'm going to select Left Channel, and hit Backspace to delete it. And then select the Right Channel and hit Backspace to delete that. So, I'm left with a value for both channels.
And if I go to the Graph Editor and select that value, you can see if I preview that, the taps of the hammer represented by this graph. Now, I want this to control my rotation. So, how do I do that? Well, let's come out of the Graph Editor and let's add an expression. So, Alt-click on the right arm. Now, just very quickly going to check that I've got the right one, yep, we've got the correct arm. So, we're going to Alt-click on the stopwatch.
Drag the pick quip over to the slider value, so we're saying take the rotation value from the slider value and it writes an expression for me doing that. Say, clear rotation value from this comp layer audio amplitude, effect both channels, slider value. And if we preview that, we should see the arm is indeed moving. Now, the only thing is, it's moving in the wrong direction and by the wrong amount.
So, what I'm going to do is use the linear expression to convert it. We've done this already, so I'm going to go through it fairly quickly. 8 equals this comp blah, blah, blah, blah, blah expression. A semicolon at the end, and then on the second line, I'm going to type in linear open parenthesis. And then, I'm going to say A, now I need to find out what those values are. So, I'm temporarily going to switch off my Expression and then I'm going to select this property and go to the Property Graph. And look in my info palette to find a minimum value of 0.17, maximum value of 20.
So, I really want this to reverse, so I probably want a minimum value of zero and a maximum value of maybe 30. Should we try that? Okay. So, what we're going to do is go down to our expression. So, it's zero and 20 we need to remember. And I'm going to say, take values between zero, and 20 and convert them to values between now. If I want to be precise, I would say 0.17 and 20.17. So, I get all the values and convert it to values between zero and it should be a minus value.
So, let's say minus 30 close parenthesis. And if we preview that, you'll see now I have the arm tapping. Now, if I switch on Motion Blur for those layers, don't really need it for the Audio Amplitude layer. And then, click on my mini flow chart. I can go back to this composition and switch on Motion Blur in here. And hopefully, see a nice animation. (SOUND) Okay, so you can use audio files to create animation for you, rather than have to work that all out yourself. So, let's have a look at that once more.
(SOUND) Okay. So there we go, using audio to control animation properties.
There are currently no FAQs about 2D Character Animation with After Effects.