MIDI clock jitter using sync~

Dan Nigrin's icon

In my very straightforward patch below, I notice a pretty noticeable jitteriness in the BPM readout when using either Logic (8.02) or Ableton (8.1.1) on my Mac (10.6.4), and using Max 5.1.5. I've noticed the same on a PC.

Max Patch
Copy patch and select New From Clipboard in Max.

Is this just a function of MIDI beat clock and its inherent jitteriness, or is there some way that I can improve my Max patch and/or Max environment settings to improve steadiness of sync?

Thanks...

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

The attached patch calculates BPM directly from MIDI clock intervals.
When feeding it from Logic over IAC the fluctuations are about +/- 0.5 BPM.
You may compare this with your method.

PS.
Of course the fluctuations can be reduced by calculating the average of multiple intervals.
But this would also reduce the reaction time on fast tempo changes.

Dan Nigrin's icon

Thanks broc - it's essentially the same thing as my patch, except I believe sync~ does what you do with Max objects internally. I thought it (sync~) might be faster, since it operates at audio rate versus scheduler rate.... But basically I get very similar results with each approach...

broc's icon

Yes, I think the BPM jitter directly reflects MIDI jitter.
It looks irritating but in general has no audible effect.

Dan Nigrin's icon

Thanks - for my application (a step sequencer), it does have some ramifications though, as any imprecision is additive; if one beat is delayed, then all subsequent beats are delayed...Unless of course some beats are a bit early in coming too. Then I suppose it would all even out in the end.

broc's icon

Yes, it will even out since the jitter consists of +/- deviations. For example, I've calculated the average from 48 clock intervals at 120 BPM and got an exact value of 120.000.

Dan Nigrin's icon

Good to know, thanks.

varvaras's icon

hi I was wondering, with this patch, how would you modify it so that you get a bang on each 'beat', so when the bpm is 120, it gives 120 bangs a minute? I want to use it to trigger a video effect based on the bpm from an external MIDI clock.

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

MIDI clock delivers 24 clock events per beat. So a 'beat clock' can simply be implemented with a counter (patch below). You may add a counter reset to 0 if you want stop and restart exactly on the beat.

varvaras's icon

thanks!