Edit: See note at end of article for warnings about this script AE CS 5.5 on Mac
Hello, pixel pushers and vert herders! Ah, it’s great to be back in After Effects land. Alas in this last year, the day job (got hired by Skype, acquired by Microsoft) and life in general (after throwing elaborate theme-parties for decades, planning a wedding wasn’t actually that hard, but still) got a little busy, but thankfully again have a little bit of time for my favorite things. That is, pixels.
Omino Python Since I released it this year, it’s been downloaded several thousand times, and about a dozen enthusiastic folks have licensed it. Alas, I don’t really have the time to either properly promote or properly support this as a paid product… so I’ll make it completely free soon.
Ok! So, MIDI!
What is MIDI
MIDI is a control protocol and file format invented 20-odd years ago for music playback on synthesizers. It records all the notes. A .mid file is typically quite small, since it has no sound data in it.
Into After Effects?
Yes! The attached script lets you read a MIDI file into After Effects, and provides keyframes with all the notes.
Install:
1. Download this file.
2. Put the file in /Applications/Adobe After Effects CS5/Scripts/ScriptUI Panels/
3. Run AE, and under window, choose om_midi.jsx, and dock the panel where you like.

Recipe
Here’s one way you could use this script. In the om_midi panel, click the little dot button, and choose a MIDI file. I used one from Wikipedia, BWV 772, one of JS Bach’s 2-part inventions.
Then, with a Comp selected, click Apply.
This creates a Null layer named “midi” with several Slider effects full of keyframes.

This particular MIDI file kept the left and right hands in separate channels, which is nice! The “pitch” effect has keyframes at the beginning of each note with a value of 60 for middle C, 61 for C-sharp, and so on. Here we can see the left and right hands’ keyframes.

A fun way to use these keyframes is to drive the Position property of another layer. I took a photo of my hand, and set the Position expression and Opacity expressions:
Position:
transform.position + 5*(0,thisComp.layer("midi").effect("ch_0_pitch")("Slider")-60)
Opacity:
transform.opacity * thisComp.layer("midi").effect("ch_0_vel")("Slider")
So the hand will move 5 pixels for each semitone, centered on Middle-C (60).
Then I rendered the audio as AIFF and added it to the comp. (I used Propellerheads Reason. Yeah… if you’re using MIDI you need yet another set of software to manipulate it.)
And here is the result animation:
More Notes
This is just the simplest usage. A more elaborate deployment might be to export just 1 part of a complex sound-track work as MIDI, to get some of the cues into your AE timeline. With more complex scripts or expressions, you could to much more than just move the hands around.
The script will put multiple keyframes with the same time-value! In the example above, you can see the hands flicker slightly as the final chord begins. Most of the the part invention has just 1 note per hand, which was nice for the demo.
Also, inside the script is a general-purpose MIDI file reader, which you could use for other purposes. I’ve generated Illustrator pictures from scores, for example, full of circles and triangles. Drop me an email or comment if you want help using it! It’s pretty fun.
Update 2012.01.08 Warning about AE CS 5.5 on Mac
Under Mac OS X AE CS 5.5, when you choose the file, it deletes it! This is a CS5.5 bug. (Works fine in CS5.)
Best workaround is to use AE CS 5 or AE CS 4.
Another workaround is:
- make a copy of the file, like myfile_copy.mid
- Select it in the script UI
- recopy the file (selecting it deleted it)
- click apply and all is well.
Hi. Been a long time since I started messing around with this plugin (and then left it alone because I had other things to deal with). Well, now I’m back on it. And I have found some really interesting things. However, I’m wondering if you are ever going to be able to add the feature of getting something OUT of the plugin — a property that can be used in an expression but goes in the opposite direction of what exists now. In other words, something that changes by the py script, but is updated by the script as a property (as opposed to the other way around, which is how all the props work now). Is this possible? Just putting one “out” integer property would be AWESOME. Thanks in advance for any response (and thanks again for the cool plugin).
Hi Chris —
There is a way! It’s a bit strange but will work. Render out a square of some color made of values R, G, B, say at (0,0,10,10). Then in an expression, use layer.sampleImage, to read it back. Something like sampleImage([5,5], radius = [.5, .5], postEffect=true, t=time).
You can use as many color-regions as desired to pass more value triplets out. (And probably want to clip your work so these “utility areas” aren’t on the final tape…)
Haha. I’ve already done that. I’d like less of a kludge.
Sorry. Should’ve made mention of that in my original comment. But is it possible to add that to the plugin?
Oh, and while I’m here … what is the correct syntax to set_hint_metrics?