View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide


Home   How To   Code Pool   Public Library   Theory   Events
Public Library

A hack to try to slave sc to external MIDI clock messages.

A singleton. No instance methods; the entire interface is through the class.


There is a workaround for the messaging latency issue. Schedule latency in terms of beats, and then with each event, divide the latency by the tempo to determine the number of seconds to use as the message latency. Note that the clock's tempo is an approximation based on the ticks coming in from MIDI, so you may lose some precision this way. If the tempo is changing, though, this is the only way to be close to on time.

var latency = 0.5;	// half a beat

r = Routine({
	var synth;
	loop {
		s.sendBundle(latency / MIDISyncClock.tempo, [\s_new, \someGrain, -1, 0, 1]);
		(rrand(1, 4) * 0.25).wait;
});, [4, latency.neg]);  // start 0.5 beat before 4 beat boundary


The clock responds to three kinds of MIDI clock messages:

More details in the help file. (updated 8/6/2005) (updated 8/13/2004: simpler modifications to make event streams work with MIDISyncClock)

Link to this Page