Importing MIDI Files into GarageBand

note, this has been pretty much superceded by Bery Rinaldo's Dent du Midi

By markd on January 21, 2004
Last modified February 5, 2004

I took the pilgrimage to my local Mac store yesterday to pick up iLife 2004 with GarageBand. I've been having a lot of fun playing with the loops and the synthesizer settings, but I wanted to do more with it. I don't play keyboards well, and I haven't been able to find a MIDI trombone for playing tunes into the system, so my next thought was to take some of the stuff I've put into Finale, export it as a MIDI file, and put it into GarageBand. Now I can finally take Mozart Symphony no 41 and put a funky beat behind it.

Unfortunately, GarageBand (at least the first version) does not import arbitrary MIDI files. Bummer.

After tossing some ideas around with the #macdev crew on IRC, I thought "I wonder if I can have one program play MIDI data, and have another program treat that like MIDI input." Someone on IRC said "check some of that patch bay software that's out there", and sure enough, I was able to cobble together a system that mostly works. (See the caveats at the end.)

The Software

I used two programs. Pete Yandell's MIDI Patchbay, and Davin K. Tanabe's Mighty MIDI.

First I set up MIDI Patchbay. Start up MIDI Patchbay, add a Patch, name the add a MIDI Input (which I called Midi Thing), and a MIDI Output (which I called GB Hack). I made sure the settings allowed all notes and data to come through:

Next I went to Mighty MIDI and opened my MIDI file. I played it to see what tempo marking it had, and then chose Device->Playback Device->Midi Thing to have it play through the patch bay pipeline.

Finally, I switched to GarageBand, pressed the record button, then went to Mighty MIDI and pressed the play button. MIDI data started flowing into GarageBand.


This is obviously a very cheesy and hackish setup. You'll lose any instrument settings in the MIDI file because everything will import into a single instrument track.

Since GargeBand thinks it's a person playing on the other end, there's no synchronization information being exchanged. If you start the playback in the last third of a beat, your GarageBand track will be a third of a beat off. This can be corrected somewhat by using the Fix Timing button of the midi track editor. It will align notes to the ruler grid. If notes end up being too far apart, they can be moved the wrong direction and you end up with Webern rather than Weber.

In the same vein, if the MIDI track is from a human performance, and GarageBand has an unforgiving metronome for a brain, anything that deviates from GarageBand's idea of tempo will end up falling on to odd parts of the measure. Also, the playback and recording tempos must be the same, otherwise your MIDI track will get out of sync with GarageBand's loops.


Here is an mp3 of
The First Noel, taken from a MIDI file I got from a random web page. Funky beat courtesy of GarageBand. This took about ten minutes of work once I got the toolchain in place. You can tell it gets a little out of sync at the end (the original performer used a little rubato), and there are a couple of overlapped notes here and there. But for 10 minutes of work, it's Not Bad. Since my plans are for moving stuff from Finale, there shouldn't be a problem (famous last words) having it generate music that lies precisely on beats, which should make the end result a little cleaner.

Here is another mp3 of MegaFortress, which took about an hour, including toggling the hymn into Finale.

borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book