[sdiy] Bunching of MIDI clock messages

ASSI Stromeko at nexgo.de
Thu Sep 12 21:11:20 CEST 2013

On Thursday 12 September 2013, 13:20:12, Richie Burnett wrote:
> Because my audio is synthesised in 2ms blocks, I could potentially have
> *seven* midi clock events arrive end-to-end in one big burst over 2ms.

So count them in the ISR and advance your internal timebase by that amount 
when your timeslice is scheduled, then process the events (if any) in your 
MIDI queue.  The only correct way to process RTM is to do it as side-channel 
data, bypassing your normal MIDI queue anyway.

> (Unlikely?, but maybe it could happen if a software sequencer lags and
> then tries to clear it's output buffer?)

The only occasion that I'm aware of where this happens in the real world is 
when an older version of Cubase (IIRC) would re-start a sequence that had 
been stopped somewhere inside a bar.  It would then send an SPP for the 
start of that bar (or the nearest quarter note, I forgot) and then whatever 
number of MIDI clocks were missing until the position it was at, then a 
START event and then resume normal clocking.  Throws off almost anything 
that relies on MIDI clock actually being at somewhat regular intervals.  But 
even then it didn't send these clock events back-to-back.

> And, before anyone says that it's the 2ms polling that's the problem... It
> has been implemented this way because the real instruments I'm modelling
> (TR-808 and TR-909) have a CPU that runs on a 2ms interrupt clock.  All
> of their instrument triggers being synchronised to this internal 2ms
> interrupt clock.  I'd like to retain this as it is one of the things that
> gives these instruments their much sought after "groove".  I guess I'm
> basing my model on archaic technology and then trying to think of how to
> make it handle a modern problem like MIDI clock bunching as gracefully as
> possible :-)

If you say so, but count me among the sceptics.

+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:

More information about the Synth-diy mailing list