Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Using audio to control animation

From: 2D Character Animation with After Effects

Video: 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.

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.

Show transcript

This video is part of

Image for 2D Character Animation with After Effects
2D Character Animation with After Effects

27 video lessons · 2788 viewers

Angie Taylor
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed 2D Character Animation with After Effects.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.