Thursday, June 9, 2011

OSX: Unimidi, IAC and MIDI Patch Bay

Some quick instructions for routing MIDI between unimidi and other programs in OSX...

OSX (10.3 and above) has the ability built in to route MIDI between programs using something called Inter-Application Communication (IAC). IAC allows you to create a pair of virtual MIDI devices (an input and an output) that applications will see as though they are usual MIDI hardware devices. When you send MIDI instructions to the output, they show up at the input. Therefore, you can send MIDI to the output using one program and use the input in another program to receive the data.

You can control the IAC settings using the built-in Audio MIDI Setup applications in the utilities folder. That program allows you to create, edit and delete these virtual device pairs.



When Audio MIDI Setup is loaded you should see the window shown above. If you don't, select Show MIDI Window from the Window menu.

Double-click the IAC Driver icon. Click More Information if the Ports menu is not showing. Make sure that there is at least one port listed -- this represents a single pair of virtual devices.

When working with Ruby, select the IAC Driver from the list of unimidi inputs or outputs that corresponds to the port that you've created. For example, the first IAC Driver output in unimidi will correspond to the output for the first set of ports in Audio MIDI Setup.

You can list your unimidi devices by using unimidi list at the command line or using UniMIDI::Device.all in Ruby.

Once you have these concepts down, you also have the option of using MIDI Patch Bay for more complex routing and filtering.

Joe Le Brech made a video of using MIDI Patch Bay and IAC to send notes to GarageBand



He wrapped all of his Ruby code in a script called output.rb so you really can't see exactly what's going on the Ruby end of things...but it should give you a general idea of how this works

3 comments:

  1. Hi Ari, I know this is an old post and unimidi is probably unsupported at this point, but I just wanted to know if you know a fix for having unimidi output sound to ableton. I googled around and I think ableton requires timestamps on their input which is the reason why ableton receives the signal, but not playing the instrument linked. I successfully played sounds using IAC to garageband, but not ableton. Any idea? Thanks.

    ReplyDelete
  2. @ayoo I'm definitely still supporting these libraries! Ableton should work the same as Garageband. I used Ableton to test all of these things when I wrote them. What do you mean by "playing the instrument linked" ? One possible difference with ableton is that the MIDI channels are 1-indexed whereas in UniMIDI they're zero-indexed

    ReplyDelete
  3. Hi Ari, I'm having the same problem of no sound playing in Ableton and also suspect it's because of timestamps. Is there a way to make UniMIDI include a timestamp with messages?

    ReplyDelete