[sdiy] Techniques for Multiplying MIDI Clock frequency?

Gordonjcp gordonjcp at gjcp.net
Sun Dec 19 11:47:47 CET 2021


On Sat, Dec 18, 2021 at 03:12:17PM -0500, Benjamin Tremblay via Synth-diy wrote:

> So, two different problems. 
> 1) MIDI clock dropping out on groove boxes. 

Depending on how much traffic the 202 is sending it may be overwhelming the Arduino.  It's a very slow processor (16MHz) with a very small amount of RAM (2kB) even by the standards of 20 years ago.  It's pretty fast but still a pitiful amount of RAM compared to the 8-bit computers I grew up with!

The Arduino libraries are crufty as hell because they try to give the same C++ experience on a huge range of hardware, so there's a lot of steps to get from "Oh I just heard a byte come in" to "here is a clock pulse".  You'd be better off not using the Arduino serial code at all and writing your own handler that deals with the clock pulse first right there in the interrupt service routine, while it's as fresh as possible.  Given that you're only looking for MIDI Clock, Start, Stop and Continue, you don't have to care about parsing MIDI.  Systems Realtime bytes can occur anywhere in any message, even Sysex messages, and are always to be interpreted as exactly what they are, as quickly as possible.

> 2) I wish I understood the theory of clock multipliers. I have seen code that measures the period between clock pulses and dead reckons the double-time pulse as an average of the recent periods. But why? Why can’t I just fire another extra HIGH-LOW pulse whenever I get a MIDI clock event? Why does timing of the extra ticks matter?  I’m assuming 48 PPQ divides the clock down to individual sequencer steps on the KPR-77. As long as the divided clock is coming in on the beat, what does it matter if some of the synthetic pulses are a little off? (They’re just shadows of the main tempo clock). It’s not like the KPR-77 is inferring something or trying to calculate BPM from the external clock… So… Anyway I just wish I knew what I was aiming for, and then maybe I could hit the target.

If you just do a double pulse it'll likely work, but if it derives shuffle from that then it'll sound quite wonky.

It's something I've wondered about myself, based on the 48ppcn shuffle on the Akai MPC family starting with the MPC60.  If you want to shuffle semiquavers so that you go from ticktickticktick to more like tick titick titick ti then you have to count incoming clocks differently.  For a straight ahead feel you'd just play your note on the first clock pulse of six TICK clock clock clock clock clock TICK clock clock clock clock clock.  To shuffle that, you'd take pairs of semiquavers and count maybe seven then five, pushing the second note a little late.  The "percentage" shuffle is the count of clocks between the first and second note divided by the twelve midi clocks in two semiquavers, so for 7/5 it'd be 58%.  8/4 would be 67% shuffle (definitely lumpy sounding) and 9/3 would be 75% shuffle (Soul II Soul - Keep On Movin', Enigma - Ode to Sadeness both spring to mind).

Now on an MPC60 you can set 54% so that means it must be 48ppcn, so each semiquaver is 12 clocks and each shuffle pair is 24 clocks.  At 48ppcn 12/24 would be 50% shuffle, 13/24 would be 54%, 14/24 would be - yup - 58%, 62%, 66%, 70%, and 18/24 would be 75% shuffle.

So I guess the MPC60 must use some sort of software PLL to evenly double up the incoming clock pulses to get 48ppcn clocks.  The Roland W30 has something like 192ppcn and also responds to external MIDI clock, so it must do some very clever measurement - or, perhaps, when you get that fine you don't really notice a bit of wibbly-wobbly clocking.

-- 
Gordonjcp
 



More information about the Synth-diy mailing list