om_midi script - Need to generate shapes using 'midi' layer's keyframes

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Posts: 1
Joined: July 10th, 2017, 11:27 am

July 10th, 2017, 12:49 pm


First time posting here and probably not the last as I've just wanted to dabble into After Effects but have started a mammoth of a project!

I'm building my own MIDI piano in After Effects that reads MIDI data using the om_midi script (found here ... gain-midi/) and is able to simulate something like Synthesia does:
What I've been trying to achieve is this whole Synthesia style MIDI piano. The idea I have is to create something like this using After Effects (piano roll and particle bursts, as well as activating keys on a virtual piano within the .aep project):
Here's what my .aep file looks like:
What I'm trying to do is be able to create a script that will read the 'midi' layers data and does the following:

1) Generates a new composition called 'Piano roll'.
2) In 'Piano roll' comp, rounded rectangles are created based on the pitch layer's keyframes. Each shape will be positioned in the correct horizontal position of the 88 keys for them to drop and hit the piano.
2a) If pitch channel is 0 + white key midi number, a light blue coloured rectangle is created.
2b) If pitch channel is 0 + black key midi number, a dark blue coloured rectangle is created.
2c) If pitch channel is 1 + white key midi number, a light pink coloured rectangle is created.
2c) If pitch channel is 1 + black key midi number, a dark pink coloured rectangle is created.
3) All these rectangles are positioned just above the comp and out of view vertically.
4) A starting keyframe is added to the transform.position based on the keyframe data, but minus a few seconds in time. This initial keyframe will be for it to sit out of view at the top.
5) An end keyframe is added to the shape layer at the exact time the keyframe is becoming active. This keyframe should move the vertical position of the shape to the bottom of the comp and out of view.

This should simulate a note falling and hitting the keys as soon as that note is active.

In most cases I will only have 2 channels to work with from the MIDI files (channel 0 for left hand and channel 1 for right hand), each which creates a pitch, velocity and duration slider in the midi layer.

Here's a mockup in Photoshop of what I'm trying to achieve:


So the area in a white border will not be part of the comp and sits out of view and when the time is right, that shape simply drops down and hits the piano keys (using the transform position keyframes) and that key also lights up as active.

When I can have the piano notes falling down, I'll just time remap the piano keys to sample the right points and active the piano keys using the 3 keys and 3 frames I've set up in their comps.

Hope this is possible as a script?

Thanks in advance for any help and advice!
Post Reply