Back to Silas S. Brown's home page

Mac MIDI player utility

mac-playmidi.c is a small public-domain C program to play MIDI files on a Mac from the command line. (Here is a binary for MacOS 10.7+ if you don't want to compile it yourself.)

If an external MIDI device (such as a MIDI keyboard) is connected to the Mac via a MIDI-over-USB connection, then the MIDI file will be played on the first such device found; if this is not possible then the Mac's own synthesis will be used. The program should compile on all versions of Mac OS X (including older ones), and it has command-line options for changing the tempo and for starting and ending at specific times (which might be useful for example if you're using the MIDI file to try and help you learn to play something on the keyboard).

Other methods of playing to MIDI devices

Aside from my command-line utility above, you might prefer to use a more graphical method of playing to your MIDI device, e.g.:


The Apple-provided "GarageBand" application can record from an external MIDI device, but playback is always to the Mac (at least on the version that comes with Mac OS 10.7; if you have a newer Mac you might find it can play back over MIDI---I haven't been able to check). The Mac's synthesizer itself is reasonable, but being able to play only from the Mac means you might have a logistical problem if you'd like the sound to come from near the MIDI keyboard (for example to mix with something else you're playing) and if it's not feasible to move the Mac's speakers appropriately (which may be the case if you're using passive hi-fi speakers).

To record in GarageBand '11 6.0.5 on MacOS 10.7.5: new track (Cmd-Shift-N or bottom-left "+" icon), record (if all red and doesn't go green, may hv to reset the MIDI connection, especially if going via a hub). If you want to multi-track, you can join the tracks via Edit / Select All (cmd-A), Edit / Join (cmd-J). Then to save, do Edit / Add to loop library, then run this script.

For fun with ground-bass loops if you don't mind playback being via the Mac: GarageBand / Preferences / General: "Cycle Recording (Automatically merge Software Instrument recordings when using the cycle region)", then record, then add a loop with Control / Snap to Grid (Cmd-G) switched OFF, then record again to add layers to the loop.

All material © Silas S. Brown unless otherwise stated.