Thursday, March 21, 2013

Dealing with MIDI Clock in PD: Sync PD to Ableton Live

MIDI clock can be used to synchronise different things together using a physical MIDI connection or a virtual MIDI bus. The midirealtimein object in PD deals with MIDI clock data. 

In terms of the data, each MIDI clock message is just a single number. There are four possibilities, depending on the state of the transport of a sequencer that is sending MIDI clock data. 

MIDI Real Time Bytes:
248 = pulse
250 = sequencer start
251 = sequencer continue
252 = sequencer stop

We also need to set up our sequencer to send transport signals in the MIDI clock format. For Ableton Live, our MIDI preferences panel should look like the screenshot below in order to send MIDI clock on IAC Bus 1. For Logic / ProTools etc, the preferences will be similar.


In PD, we need to set up our MIDI devices so that IAC Bus 1 is an input device, like so:


Then, we can use the midirealtimein object in to intercept the MIDI clock bytes from the IAC Bus 1. When the play button is pressed in Live, the midirealtimein object will output 250. During playback, the value 248 will be sent 24 times per quarter note. When the stop button is pressed, the object will output 252. This information can be used to sync a PD patch to a MIDI clock source.

For example, this patch triggers at a rate of 16th notes:


0 comments: