MIDI to OSC Conversion with Pure Data (pd) and Ableton Live

I’m putting together a live audio/visual performance setup which will include two laptops.  The first laptop will be processing all audio and MIDI triggers, while the second laptop will be converting the MIDI information into some sort of visual representation. I’ll get into the visuals that I will be coding with the use of  Cinder in a future post.  For now, I just wrote two Pure Data patches: one to convert MIDI information to OSC messages and one to set the OSC message endpoint for LiveOSC.

1.) Convert MIDI note information to OSC messages.
OSC (Open Sound Control) is just human readable “MIDI-like” information sent over UDP network packets. If you don’t know what UDP really is, you can think of it as a stream of information being blasted over your network from one program to another program (without any feedback on whether the message was received properly).  However, there is a lot of open source code out there that has been written to transmit, receive, and parse these OSC messages, so its a nice protocol to use when transmitting MIDI-like information over a network. For this patch, I targeted sending MIDI information from Ableton Live to Pure Data, where it was packed into an OSC message and broadcasted to the other computer. To setup Ableton live to transmit MIDI note information, go to a MIDI track in your Ableton live setup and select a software MIDI output device (See my post on IAC Driver for MAC or use MIDI-Yoke for Windows).  Then you will need to setup a MIDI track in Ableton live to transmit its MIDI information to the IAC Driver, which is received through the IAC Driver in Pure Data. The following Pure Data patch converts the MIDI to OSC and transmits it over the appropriate network.

MIDI to OSC

MIDI to OSC in Pure Data

You can download the patch here: http://www.kevindemarco.com/archive/midi-to-osc.pd

The end point for the OSC message is determined by the “local” vs “remote” radio button and the IP address in the connect message.  Use localhost when you want the OSC endpoint to be on your current machine, use “remote” when you want to send the OSC messages to another computer.  Also, when using “remote” make sure to set the IP address in the connect message.

I tested the network activity with a combination of WireShark and the example OSC listener in Cinder. If you have never used WireShark and you plan on doing any network related activities, you really need to learn to use it… and it’s open source.

I’ll write about the LiveOSC endpoint selector patch in another post. This is too long already.

-Kevin