[sdiy] Bunching of MIDI clock messages
rburnett at richieburnett.co.uk
Thu Sep 12 14:20:12 CEST 2013
Hi all, and thanks for the wealth of replies about this and links that I'm
still reading through...
Florian Anwander wrote:
> I would make the timer toggle each 6 or 8 clocks (depending on the
> measure system - whether its 16th based or triplet based). Then you have
> a 16th notes clock, which is widely usable, and your are not bound to
> quarter beats.
And this is where my potential problem starts...
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.
(Unlikely?, but maybe it could happen if a software sequencer lags and then
tries to clear it's output buffer?)
If I simply set a flag that says "A quarter note beat has occurred" in the
MIDI interrupt service routine I will fall behind time because two quarter
note events have actually occurred in rapid succession between my 2ms
polling points. So it looks like I need to keep track of how many clocks
arrive over each 2ms synthesis block and then quickly process them between
each block of synthesis. By "process them" I mean update the current "song
position pointer", and fire off any drum sounds that occurred at all the
MIDI clock steps in between. The later being needed to make sure no beats
in the pattern are skipped.
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 :-)
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.3392 / Virus Database: 3222/6659 - Release Date: 09/12/13
More information about the Synth-diy