Using MIDI to Control Animation in After Effects | Part 1

Ready to test the limits of what's possible in After Effects? In this lesson you're going to unleash some real creativity with using a piece of software for something that it wasn't really built for in the first place. There's going to be some plugins and expressions that you'll need for this lesson, so head on over to the resources tab to grab those. 

If you have any questions, click over to the Q&A tab to post them. Other students can answer you, and we'll put our team on the case to try and get you a solution ASAP.

You’ll need this free Omino AE Script to complete this tutorial.

You can find some free MIDI files here.


Put this expression on a layer’s scale. Make sure you have the MIDI information pasted onto a null called “midi” which has information in the “ch_9_vel” channel. If the MIDI came into another channel, adjust the expression. 


s=linear(val, 0, 127, 50, 500);


    00:00:31,543- Yo!
    00:00:32,376Joey here at School of Motion
    00:00:33,393and welcome to day five of 30 Days of After Effects.
    00:00:36,571Today, we're going to get experimental and talk about how
    00:00:39,265to get MIDI information into After Effects
    00:00:41,426to create animation driven by that data.
    00:00:44,582If you don't know what MIDI is,
    00:00:45,707don't worry; I'll explain that, too.
    00:00:47,589We're gonna be in and out of After Effects today;
    00:00:49,844because we're going to have to use another program,
    00:00:52,403Logic, to be specific,
    00:00:54,095to actually create the MIDI information.
    00:00:56,521Now hopefully, this is really interesting
    00:00:58,413and gives you some cool ideas
    00:00:59,692about unique ways to use After Effects.
    00:01:02,586Don't forget to sign up for a free student account
    00:01:05,031so you can grab the project files,
    00:01:06,561example MIDI from this lesson,
    00:01:08,203as well as assets from any other lesson on the site.
    00:01:10,876All right, let's check this out.
    00:01:13,295So, let's start out this first video
    00:01:15,396by doing a quick primer on what MIDI is
    00:01:19,439for those of you that don't have any experience with it;
    00:01:22,557and for those of you that do, who knows?
    00:01:24,979Maybe you'll learn something.
    00:01:26,734This app that I'm in right here is called Logic
    00:01:30,931and there's a lot of different programs out there
    00:01:33,843that you can work with audio.
    00:01:37,560You got Pro Tools, Logic, Cube Ace, Sonar,
    00:01:41,115I mean, there's a lot.
    00:01:42,320If you have a Mac, it comes with Garage Band,
    00:01:44,728which can do MIDI.
    00:01:46,090I just like to use Logic.
    00:01:47,616First, let me just show you what MIDI is.
    00:01:51,036If I hit 'play'...
    00:01:57,910It just sounds like bad 80s music.
    00:02:01,379So, what MIDI is,
    00:02:02,928it's a way of storing musical information, okay?
    00:02:07,669This song, and I just downloaded this off a free MIDI site,
    00:02:12,606it's got six instruments here
    00:02:14,990and each instrument has it's own track.
    00:02:16,663If I click on each one,
    00:02:17,677you can see that there notes assigned to each one.
    00:02:20,993When you go into a recording studio,
    00:02:22,512typically you have microphones and you record the audio,
    00:02:26,170and once it's recorded, you can edit it and do things to it.
    00:02:29,745Typically, that's what you got.
    00:02:31,585Whatever you play, that's what you get.
    00:02:33,256With MIDI it doesn't work that way.
    00:02:35,072With this track selected, I'm just gonna hit 'play'
    00:02:37,509and you can hear what it's doing
    00:02:39,055and you'll be able to see exactly what all these notes mean.
    00:02:46,382When you go to a recording studio
    00:02:47,901and you play a piano in front of a microphone,
    00:02:51,705you've recorded an actual audio file;
    00:02:54,240but, when you record MIDI,
    00:02:55,832all you're recording is the information
    00:02:57,698about when you hit each key on the keyboard,
    00:03:00,615how hard you hit the key,
    00:03:03,392and it records just a bunch of data.
    00:03:05,645What's great about that is then you can change it.
    00:03:07,916If I take these two notes, I can move them around, right?
    00:03:15,306I have made the song even worse than it already is.
    00:03:17,810So, that's how MIDI works
    00:03:20,119and you can see that it works on a grid system.
    00:03:24,907This is great if you don't actually know
    00:03:28,124how to play an instrument,
    00:03:29,160you can still make music really simply.
    00:03:34,527Let's get rid of some notes here.
    00:03:35,728You can just program in whatever you want
    00:03:40,173just by adding notes.
    00:03:42,718There's a note.
    00:03:51,142So, that's how MIDI works.
    00:03:54,587If you actually play piano, if you have a keyboard,
    00:03:58,017you can really easily record your own MIDI information.
    00:04:03,067As an animator, this was intriguing to me
    00:04:05,185because especially when you're doing animations
    00:04:08,911that have to be timed out to music,
    00:04:10,594or you want things to sync up to a beat,
    00:04:12,359or something like that, it can be very tedious.
    00:04:15,058There's some ways to do it in After Effects.
    00:04:17,111There's plug-ins that can try to figure out
    00:04:20,595when the kick drum's being hit,
    00:04:22,241when the snare drum's being hit and read the audio file,
    00:04:25,835but if you could actually get this information
    00:04:27,887into After Effects, that would be super useful.
    00:04:32,953So, first thing I want to do
    00:04:33,986is I want to show you guys how I got some MIDI information
    00:04:38,247that I thought would be useful.
    00:04:41,322I play drums, so I use an interface called an Octopad
    00:04:46,455and I'll link to a little more information about that
    00:04:48,580if any of you guys play drums and you're curious about it.
    00:04:51,594What I have here is I have a track
    00:04:54,445and I've got a plug-in that I use
    00:04:56,808when I actually play drums in Logic.
    00:05:01,160It's called Superior Drummer.
    00:05:02,338It's this really cool plug-in
    00:05:03,627that works for a lot of programs
    00:05:05,309and it lets you use MIDI to control
    00:05:08,928this very realistic drum set sound.
    00:05:15,166I have that set up
    00:05:16,617and now I'm gonna walk over
    00:05:18,741and I'm gonna sit down on Octopad
    00:05:20,923and I'm just gonna hit record.
    00:05:23,412(metronome plays)
    00:05:30,207(playing drums)
    00:05:40,008So, that shows you exactly how MIDI works.
    00:05:42,528As I'm playing the drums,
    00:05:44,444Logic is just recording on each little track here
    00:05:48,253exactly what I played.
    00:05:49,920The different colors are just showing you
    00:05:51,450different velocities, right?
    00:06:02,906You can see that the red hits are the strongest ones
    00:06:05,622and the green are the weaker ones.
    00:06:08,252What's really great, especially if you're a drummer,
    00:06:10,319is you can select all these notes
    00:06:12,206and you can fix them real quick.
    00:06:15,204Now, everything's gonna be perfectly in time.
    00:06:23,481The ending's not in time, but what are you gonna do?
    00:06:26,574Anyway, there's our MIDI information, okay?
    00:06:30,652What I wanna do is
    00:06:34,100I wanna be able to use this
    00:06:35,500in a way that's useful in After Effects.
    00:06:38,619I'm gonna rerecord something
    00:06:40,436and I'm gonna make something very, very simple.
    00:06:43,093Then I'm gonna show you how to get that into After Effects,
    00:06:45,285and I'm gonna show you the basics
    00:06:47,611of how to start working with that information.
    00:06:51,460In part two of this tutorial,
    00:06:54,306I'm gonna get into some pretty crazy expressions
    00:06:57,052which will let you really, really control stuff.
    00:06:59,222Let me hop back over to the kit
    00:07:00,603and I'll just do something really, really simple.
    00:07:03,458(metronome plays)
    00:07:08,366(playing drums)
    00:07:17,004So, that was much simpler
    00:07:18,685and this is gonna be easier to work with in After Effects.
    00:07:20,935Let's just make sure that it sounds the way we want.
    00:07:30,992Great, okay.
    00:07:32,406What I'm looking for here
    00:07:35,160I want a little bit more variation
    00:07:38,186in the dynamics of the playing.
    00:07:40,998You can see a lot of these hits are red,
    00:07:43,223but you've got a few of them in there
    00:07:45,197that are different colors.
    00:07:46,084What I'm gonna do is I'm just gonna select some of these
    00:07:48,516and I'm just going to change the velocity of them,
    00:07:51,118which is gonna make them a little bit different.
    00:07:53,871This will make it a little bit easier to see
    00:07:55,426what's going in After Effects.
    00:08:01,624Maybe I'll make these two a little softer, too.
    00:08:06,965See, this is what's great about MIDI.
    00:08:08,899Especially if you're a musician,
    00:08:10,255you really can just tweak the crap out of this stuff.
    00:08:17,469Maybe I'll make these two a little softer.
    00:08:20,908There we go.
    00:08:23,725This one can be a little softer.
    00:08:29,060And then, we'll make these a little bit softer, too,
    00:08:31,562so it's more of a build up at the end.
    00:08:33,751There we go.
    00:08:35,809There we go.
    00:08:46,085All right.
    00:08:46,918So, first thing we need to do
    00:08:48,214is export an audio file of this.
    00:08:50,933And I'll show you how to do it in Logic.
    00:08:53,737In Garage Band, it's gonna be a slightly different set up,
    00:08:59,464but all you need to do is use the internet
    00:09:02,171and figure out how you export an audio file
    00:09:04,273out of your digital audio workstation program.
    00:09:08,126So, I'm gonna just select this region
    00:09:10,202and I'm going to bounce this track
    00:09:12,162and we're gonna call this...
    00:09:15,067Let me make a new folder here
    00:09:16,257and we'll call this 'demo.'
    00:09:18,142this is gonna be my 'Toms Audio.'
    00:09:23,080All right, now you guys probably saw
    00:09:25,590that I trimmed this little layer.
    00:09:29,061There was some extra stuff at the beginning
    00:09:31,402that I didn't need.
    00:09:32,992I trimmed it so it was just the part
    00:09:34,752of the audio that I needed.
    00:09:40,084If I just export this as is from Logic,
    00:09:42,823what I've found is that it actually exports
    00:09:44,709even the notes that I thought I erased.
    00:09:47,664What I need to first do is come down here
    00:09:49,595and in my edit menu just say
    00:09:51,111'delete MIDI events outside the region boundaries.'
    00:09:56,147again, this is how Logic works
    00:09:58,174and I'm on the newest version of Logic.
    00:10:01,615If you're using Pro Tools or something,
    00:10:02,976you just need to look up exactly how to do that.
    00:10:06,134Then, we're just gonna go
    00:10:07,585'file, export, selection as MIDI file.'
    00:10:12,991Actually this error message
    00:10:14,270is what I was hoping wouldn't happen.
    00:10:15,695It's saying 'there are some events
    00:10:17,471before position one one one one.'
    00:10:19,666So, it's actually saying that
    00:10:21,495there are MIDI events that it's sensing
    00:10:25,447that are happening before the beginning of the song.
    00:10:28,949Actually, if I zoom in here
    00:10:30,635I think I see what it's doing.
    00:10:31,723You see how this first hit
    00:10:33,500is actually a little bit before the beat?
    00:10:37,377There we go.
    00:10:38,210I just moved it.
    00:10:39,708Let's see if I try to export this now if it works.
    00:10:42,302'Export, selection as MIDI file.'
    00:10:44,807There we go.
    00:10:45,640We're gonna call this
    00:10:48,320'Demo, Toms Audio
    00:10:55,189There we go.
    00:10:56,040Now, we have a MIDI file.
    00:10:58,691Now, let's hop into After Effects
    00:11:00,908and let's talk about how to get this information
    00:11:04,436into After Effects.
    00:11:06,765Ha! I lied!
    00:11:07,714We're not in After Effects.
    00:11:08,835We're actually in a web browser and why is that?
    00:11:11,037Well, there's not a built-in way in After Effects
    00:11:13,674to get MIDI information in.
    00:11:16,163You have to use a plug in
    00:11:18,142and this is the only one I've found.
    00:11:21,658It works great.
    00:11:23,957I've actually mentioned this site
    00:11:26,170in another one of these 30 Days of After Effects tutorials.
    00:11:29,590This guy has made a bunch of free plug ins and scripts.
    00:11:32,719In one of them is a MIDI importer, all right?
    00:11:36,850So, you go to his website, and you download it.
    00:11:40,235It's a script, so you need to follow the instructions
    00:11:42,559to actually install it in the right place.
    00:11:46,567Then, once you install it, it shows up in After Effects
    00:11:50,985in your window menu right here.
    00:11:52,621'o-m-underscore-midi' and here it is, okay?
    00:11:57,389First thing I need to do is import
    00:12:01,924that Tom Tom audio.
    00:12:03,949So, let's go into the 'demo' folder,
    00:12:05,864let's grab the 'Toms Audio',
    00:12:07,334let's throw it down there,
    00:12:09,148and let's just preview that real quick.
    00:12:18,093Great. There it is.
    00:12:19,051Works perfectly.
    00:12:22,053Your typical workflow to sync things to this
    00:12:25,394would be open up the the audio wave form,
    00:12:27,758which, if you guys don't know this,
    00:12:29,661you double tap 'l' on an audio layer-
    00:12:31,986Brings up the wave form-
    00:12:33,883and maybe adding some markers wherever there's a hit.
    00:12:38,208Now that we a MIDI, we have much more powerful tool,
    00:12:41,293so let's import the MIDI.
    00:12:43,201What we're gonna do is make sure
    00:12:44,875that our 'o-m-underscore-MIDI' script is open,
    00:12:48,012and we're gonna click on this little tiny icon there.
    00:12:50,803This is where we tell it which MIDI file.
    00:12:53,892So, I navigate to the folder,
    00:12:55,308there's the MIDI file, hit 'OK.'
    00:12:57,986Now, this script
    00:13:00,235it's not a professional thing that you buy,
    00:13:03,819so sometimes it's a little bit finicky, okay?
    00:13:06,772I've found that what works best
    00:13:07,974is to make sure you have the correct COMP open,
    00:13:11,001and select some layer in there.
    00:13:14,374It just helps tell this script
    00:13:17,028that this is the COMP I want you
    00:13:18,628to put the MIDI information into.
    00:13:21,206When you hit apply, it should work.
    00:13:23,216There we go.
    00:13:24,049All right, now here's what it did:
    00:13:25,592it created a 'null'
    00:13:26,986and I usually just immediately rename that 'null' 'MIDI.'
    00:13:31,006You can see that it's put a bunch of effects on here.
    00:13:33,883Now, the effect that it put on there
    00:13:35,561is actually my good buddy, the expression slider.
    00:13:39,729It's renamed them
    00:13:40,807'channel zero', 'channel zero', 'channel zero',
    00:13:43,043'channel nine', 'channel nine', 'channel nine.'
    00:13:45,113If I click on this 'null' and I hit 'u',
    00:13:47,079let's take a look at what we got.
    00:13:48,445We've got a bunch of key frames in there, okay?
    00:13:50,613Now, watch.
    00:13:51,446I'm gonna play the audio
    00:13:52,415and I want you to watch this play head.
    00:14:00,784isn't that cool?
    00:14:01,617These key frames line up to the audio.
    00:14:04,662Now, we need to know how to interpret them, okay?
    00:14:10,610Here's one of the issues that I have found with this.
    00:14:16,103I'm not sure if there's a work around
    00:14:17,527and if someone figures this out, please tell me.
    00:14:20,799We work
    00:14:22,885in video,
    00:14:23,718we work in frames.
    00:14:27,661This COMP, for example, is 24 frames a second,
    00:14:31,714but if you listen to the Tom hits at the end,
    00:14:36,245they're happening pretty quickly and
    00:14:39,854if I go back to Logic
    00:14:42,613and I zoom out
    00:14:43,557so we can really see all my hits,
    00:14:46,998you can see that there's, basically, nine hits here.
    00:14:52,511If we come into After Effects
    00:14:54,014and we look at the very last little bit here,
    00:14:57,850there's three, four, five...
    00:15:00,726I can't tell.
    00:15:01,559That looks like there might be two in there,
    00:15:03,228kind of snuck in.
    00:15:04,673And what happens is the plug-in actually tries
    00:15:07,554to put the notes in on individual frames for you.
    00:15:13,570Sometimes, it just gets screwed up.
    00:15:15,240You see how there's two notes right next to each other?
    00:15:19,043When you play quickly when notes are very close together,
    00:15:23,810this script, it doesn't do a great job
    00:15:27,624of putting things exactly where they should be.
    00:15:30,942For most cases, close enough
    00:15:32,854and in the way that I used it in the demo
    00:15:35,888with the most amazing song ever written, Africa,
    00:15:40,686I deliberately kept my playing pretty simple
    00:15:43,687knowing that this is how it's gonna get used.
    00:15:46,649Here, let's just play this one more time.
    00:15:51,513All right, if you listen to the beginning,
    00:15:53,570there's three hits right in a row
    00:15:57,088and we're seeing here's three key frames,
    00:15:59,631but then here's six key frames.
    00:16:02,465Then, over here we've got this channel,
    00:16:04,982'channel zero velocity' that has nothing in it.
    00:16:08,716So, the first thing I like to do
    00:16:09,805is clean up the MIDI information a little bit
    00:16:12,275and this channel zero has nothing on it.
    00:16:14,746So, I'm gonna delete all three of these channel zeroes
    00:16:17,871that it's giving me.
    00:16:19,121Now, all I have is channel nine.
    00:16:20,351Now, in MIDI, there's a lot of different things
    00:16:23,995that can be measured.
    00:16:25,370Obviously, the timing when I actually hit the drum
    00:16:27,983is measured, but also how hard I hit is measured.
    00:16:32,585That's the velocity.
    00:16:34,192If I click on this and I go into my graph editor,
    00:16:36,376you can actually see...
    00:16:46,524You can actually see that the velocity
    00:16:48,432matches up perfectly to my audio.
    00:16:50,787Now, the pitch on this isn't gonna change
    00:16:53,220because I'm playing one drum.
    00:16:55,207If you had a piano instrument, though
    00:17:00,074then you would have
    00:17:03,103the same three channels.
    00:17:04,968You'd have the duration
    00:17:08,104and the duration of a drum hit
    00:17:09,872is generally just an instantaneous thing.
    00:17:12,660That's why when I click this,
    00:17:14,281there's to a lot going on here.
    00:17:16,742The velocity is changing,
    00:17:18,636but when you're playing a piano,
    00:17:20,602you actually might hold a note for a second
    00:17:23,236and then let go.
    00:17:24,171This will actually have more information in it
    00:17:26,949for a piano than it does for a drum.
    00:17:29,368You'll also have velocity information
    00:17:30,914and then, you'll also have pitch information for the piano,
    00:17:34,663or for any instrument that has notes.
    00:17:36,995This chart will move up and down
    00:17:38,777and tell you the pitch of the instrument,
    00:17:42,510which you could do some cool stuff with, too.
    00:17:44,287For now, let's keep it kind of simple.
    00:17:46,059The drum doesn't have a pitch,
    00:17:47,415so I'm also gonna delete that.
    00:17:49,511So now,
    00:17:51,847the way that this works
    00:17:54,373is whenever I hit a drum
    00:17:57,645and it lands on a frame,
    00:17:59,788I get the key frame on the duration.
    00:18:06,315Here's our first problem with the duration.
    00:18:08,144You can see there's four key frames.
    00:18:10,078There's actually five hits.
    00:18:14,533It sort of didn't register the first one or something,
    00:18:17,829but on velocity it did register all of them.
    00:18:21,956What happens with velocity
    00:18:23,854is it actually puts an extra key frame at the end.
    00:18:29,608That extra key frame levels it back out.
    00:18:33,344You see that?
    00:18:36,174You can delete that or you can just ignore it.
    00:18:39,537You could go through
    00:18:40,370and just delete each of these key frames
    00:18:43,130if you didn't wanna use that.
    00:18:47,269Until you actually start using the data,
    00:18:49,625you're not really sure how it's gonna work.
    00:18:53,497Just for this example, let's just leave this as is
    00:18:56,916and let's start doing something.
    00:18:59,834Here's a quick and easy thing
    00:19:01,930and just so you guys know,
    00:19:03,246you're gonna have to use Expressions to do this.
    00:19:05,698There's no other way to really make this work.
    00:19:10,296Again, if you've watched any of my After Effects tutorials,
    00:19:14,267you know I love Expressions.
    00:19:15,432It's kind of my thing.
    00:19:20,129I want you guys to get more comfortable with them.
    00:19:23,005All I'm gonna do, is I'm gonna make a little circle here
    00:19:27,011and I'm just gonna tie the scale of the circle
    00:19:31,290to this.
    00:19:33,565Let's look at the velocity here.
    00:19:36,958The highest it gets is 127,
    00:19:43,327so if I go here, if I go forward one frame,
    00:19:45,449you can see that the value is 127.
    00:19:48,947The reason that number is 127
    00:19:50,389is because that's just the scale that MIDI works at.
    00:19:54,539If we go back into Logic and take a look at this...
    00:19:57,206Let me open up this little guy down here.
    00:19:59,621I'm gonna change this graph to 'Note Velocity.'
    00:20:03,776So, now you can see with all the notes
    00:20:05,844that there's a corresponding dip in this velocity.
    00:20:09,668If I hold my mouse over this note, it says velocity 127.
    00:20:13,947If I hold it over this note, velocity 80.
    00:20:21,126So, this is the information
    00:20:22,406that's going back into After Effects.
    00:20:26,290So, that's the maximum, 127 and the minimum is zero, right?
    00:20:30,084If I'm not hitting anything, then the velocity is zero.
    00:20:33,474So, what I wanna do
    00:20:35,814is I wanna put an Expression on the scale of this circle.
    00:20:41,684What I want the scale to do
    00:20:43,041is to look at this velocity slider
    00:20:45,790and I want it to scale from 100%
    00:20:49,635when I'm not hitting the drum,
    00:20:50,831maybe up to 200% when I'm hitting it as hard as I can.
    00:20:54,512And when I'm hitting it in between,
    00:20:56,285I want it to be somewhere in the middle.
    00:20:58,553So, the way we do that is
    00:21:00,832we first need to set up a variable
    00:21:02,946just to make this easier to read.
    00:21:04,208The value I want this Expression to look at
    00:21:07,372is this slider, channel nine velocity.
    00:21:10,946I'm just gonna make a quick variable:
    00:21:12,628Val equals, val is just short for value, equals this.
    00:21:17,019We always have to add a semicolon at the end.
    00:21:20,508Then I'm gonna use the linear Expression.
    00:21:23,062Linear Expression in After Effects is awesome.
    00:21:26,158It lets you take one number that's changing over time
    00:21:30,441and map it to a different number over time.
    00:21:35,397If you had a value, for example,
    00:21:38,470the velocity of a MIDI note going from zero to 127,
    00:21:42,710but I wanna map the scale of this circle
    00:21:45,795to go from 100 to 200, that's exactly what linear does.
    00:21:49,239The way it works is you type in linear.
    00:21:51,884In parenthesis, you have to give it five arguments.
    00:21:54,165The first one is what value am I looking at.
    00:21:56,701Well, we're looking at that variable
    00:21:57,858we just made called Val.
    00:21:59,799Then, the next two arguments
    00:22:01,803are the minimum and the maximum number
    00:22:04,266that is expected to come out of this thing you're measuring.
    00:22:09,105So, we know the minimum is zero and the maximum is 127.
    00:22:13,528Then, the next two numbers
    00:22:15,268are what are we going to map to these two numbers.
    00:22:19,793So, when this value is zero what should the result be?
    00:22:24,732Well, when I'm not hitting a drum,
    00:22:27,239I want the scale to remain at 100,
    00:22:29,547so I'm just gonna type in 100.
    00:22:31,471And when I'm hitting the drum as hard as I can,
    00:22:33,378I want it to go up to 200.
    00:22:36,005And that's it.
    00:22:38,807Oh boy, we've got an error.
    00:22:40,852Yes, here we go.
    00:22:42,583The error message was telling me
    00:22:44,119that this expression won't work because-
    00:22:47,829and I'm glad you guys saw that because you see,
    00:22:50,117even when you use expressions all the time,
    00:22:51,481you still screw them up every time.
    00:22:54,220So, scale is expecting an X and a Y number,
    00:22:58,077and I'm only returning one number here.
    00:23:01,146I'm actually gonna say this:
    00:23:02,990'S equals linear.'
    00:23:05,042Now, I'm setting up one more variable, 'S',
    00:23:07,214which is gonna store the value
    00:23:09,128that comes out of that linear expression.
    00:23:11,765Now, I can return instead of one number,
    00:23:14,190I can return an X and a Y.
    00:23:16,870The way you do that is with opening bracket
    00:23:20,094and then the first number, S,
    00:23:22,323comma, the second number, S. close the brackets.
    00:23:25,575So, all I'm doing is I'm telling After Effects
    00:23:28,692I want this X number and this Y number to be the same.
    00:23:32,318Both of the numbers we'll get
    00:23:33,700will come from this expression here.
    00:23:36,989If you are very unfamiliar with expressions,
    00:23:39,249maybe you should watch
    00:23:40,108the Intro to Expressions in After Effects video.
    00:23:42,822So, now this expression should work.
    00:23:45,423Now, let's do a quick RAM preview.
    00:23:47,919Let me set this to half so it goes a little quicker.
    00:24:00,929Let's make this number a little bit bigger, too.
    00:24:02,724Let's make this 500 and then let's make this number 50,
    00:24:05,751so we can get a lot more variation out of it.
    00:24:15,973So, that's it in a nutshell
    00:24:18,466how to get MIDI information in to After Effects
    00:24:21,136and how to begin using it.
    00:24:22,952I wanna show you guys one other thing I ran into
    00:24:25,204while I was preparing for this.
    00:24:27,606I'm not exactly sure why, but it might be useful
    00:24:30,908for you guys to know about this.
    00:24:33,228I recorded a different piece of audio here.
    00:24:38,040Let me grab it.
    00:24:38,873It's this piece of audio which is just...
    00:24:42,984Let me hit 'l-l' here.
    00:24:45,814This is a snare drum.
    00:24:48,313Kinda just a solo piece here, right?
    00:24:53,851What's different about this from the Tom thing I did,
    00:24:58,658is I'm playing a lot faster, right?
    00:25:03,401There's just a lot more notes to it.
    00:25:05,861This is also longer.
    00:25:06,953This is about 22 seconds here.
    00:25:10,382Here's what happened when I inputted the MIDI information.
    00:25:14,780That MIDI information is here.
    00:25:17,150Okay, snare two.
    00:25:20,827Then, let me hit apply.
    00:25:22,934That brings it in.
    00:25:24,935What I noticed was I got MIDI information
    00:25:27,381that went way out past
    00:25:31,825my actual audio file.
    00:25:33,140I thought that was weird.
    00:25:35,501So, here, let me delete this channel that has nothing on it
    00:25:38,256and the pitch channel which we don't need,
    00:25:40,082and let's look at the velocity channel.
    00:25:42,474I'm gonna zoom in a little bit here.
    00:25:48,133You notice right away that it doesn't seem
    00:25:49,966to be matching up to the audio at all.
    00:25:51,809I thought that's really strange
    00:25:52,945and I didn't really understand
    00:25:54,257why there were so many extra key frames here.
    00:25:57,761So, what I did was
    00:26:01,929I moved this layer over and I'm just gonna grab...
    00:26:06,850I'm gonna, basically, click on this slider
    00:26:08,803and then hold shift and click on this
    00:26:10,001just to select every key frame,
    00:26:11,957and then while I'm holding option,
    00:26:14,069I'm gonna grab the very last key frame
    00:26:15,518and move it to the left.
    00:26:16,515What I'm doing is I'm scaling all of these key frames
    00:26:20,197and what I wanna do
    00:26:21,851is try to line up this last key frame
    00:26:24,039with this last snare hit right here.
    00:26:30,154So, I'm basically just going in...
    00:26:32,415If you go into the graph editor,
    00:26:34,793and you select both of these...
    00:26:36,588So, you go to the graph editor, tap this
    00:26:41,839Then, hold shift and tap this
    00:26:43,206and it will select everything
    00:26:44,904and if you have this little button checked,
    00:26:46,635the transform box,
    00:26:48,958you can actually scale them
    00:26:50,150and scale them in between frames
    00:26:51,666so you can really line that last little hit up.
    00:26:56,183All I've done is I've taken my MIDI key frames
    00:26:58,059and scaled them.
    00:27:00,079Now, let's play this.
    00:27:08,568So, you can see now, it lines up perfectly
    00:27:10,770and I actually did check it
    00:27:12,049and it lines up all the way through to the end.
    00:27:19,019So, if you have a ton of MIDI notes and it's a longer piece
    00:27:23,020just know you may have to scale the key frames, okay?
    00:27:28,018This is actually...
    00:27:29,162This is pretty great.
    00:27:30,133This shows you exactly why
    00:27:31,437using MIDI information could be so useful,
    00:27:33,504because look how many key frames there are
    00:27:36,067and how much information is here
    00:27:38,442and if you had to hand key frame that,
    00:27:41,157it would just suck.
    00:27:43,626This is a way better way to do it.
    00:27:46,212Then, just out of curiosity,
    00:27:48,573why don't I copy this circle here
    00:27:52,107and I'll just paste it into this
    00:27:53,870and we can see exactly how it reacts
    00:27:56,032to this piece of audio.
    00:27:57,936So, I'm just gonna double tap 'u'
    00:28:00,500to bring up everything I've changed on my circle layer
    00:28:04,603and this will bring up this expression.
    00:28:08,122Here's something that's kind of cool.
    00:28:09,797Because I named my null 'midi',
    00:28:13,871in the expression that's actually what is was looking for.
    00:28:16,320It was looking for a layer named 'midi.'
    00:28:18,787it just worked and I don't have to change anything.
    00:28:21,132Let's do a quick RAM preview here
    00:28:24,098and just play a little bit of this.
    00:28:34,694You can see that it's working.
    00:28:36,330Now, obviously it's very jerky
    00:28:38,826and it's not super useful yet.
    00:28:40,700I mean, if you just wanted something
    00:28:42,431really flickery and cool
    00:28:44,161and maybe you just wanted a layer
    00:28:45,318to turn on and off instantly in time with music,
    00:28:48,198you can do a very simple expression like this
    00:28:50,073and get that to work.
    00:28:51,395If you wanna have things be triggered
    00:28:54,293and trigger particles and things like that,
    00:28:56,853then it's a little more tricky.
    00:28:58,619So, in the next tutorial, that's what we're gonna get into.
    00:29:01,625Hopefully, this was a good foundation,
    00:29:03,789a good base of knowledge,
    00:29:05,398so when we get into the more advanced stuff,
    00:29:06,791it'll make a little bit more sense.
    00:29:08,268Thank you guys, as always and I'll see you next time.
    00:29:10,982Thank you so much for watching
    00:29:12,703and make sure you check out part two of this tutorial
    00:29:15,003where we'll actually get really deep into expressions
    00:29:18,067to make this stuff all work the way we want to.
    00:29:20,596If you learned something valuable from this video,
    00:29:22,508please share it around.
    00:29:23,698It really helps us spread the word
    00:29:25,984and when you do that, we really appreciate it.
    00:29:28,610Also, don't forget to sign up for a free student account
    00:29:31,093to access the project files for the lesson you just watched
    00:29:34,217plus a whole bunch of other goodies.
    00:29:35,900Thank you so much.
    00:29:36,768I'll see you next time.