Clock sync without sync

Hi folks - long time member, first post here.

Long story short I think I’ve solved a sync issue between my hardware sequencer and DAW, but I’d like to understand the details better. This is a cross-post from the electrical engineering stack exchange, hope that’s ok!

I have a hardware music sequencer (Squarp Pyramid), a laptop, a digital MIDI-triggered drum synthesizer (Roland TR-8), and an audio mixing console with built-in USB audio (Soundcraft Signature 12 MTK). Using my laptop with DAW software (Reaper), I record a sequence of drum beats from the TR-8, triggered over hardware MIDI from the Pyramid:

Audio setup

What I find is that the beat-markers in Reaper drift over time compared to the onsets of beats in the recorded audio - between 10ms and 20ms per minute of audio, depending on the BPM. This is expected, of course, but I’d like to reduce it as much as possible.

I don’t have access to a reliable way of keeping the clocks in sync. The solution I’m working with right now is to use a slightly modified BPM on Reaper to compensate for the drift. For example, for 125BPM on the Pyramid, I set reaper to 125.02BPM. For 117BPM on the Pyramid, I set Reaper to 117.0382BPM. This reduces the drift to fractions of ms per minute of recorded audio, which I can live with - but I have to work out the drift by hand, and it’s different for each BPM.

My method for determining the drift amount is as follows:

  1. Record 10 minutes of audio with beat pulses at a particular BPM.
  2. Align the onset of the 0th recorded audio beat with t=0 in Reaper.
  3. Find the nearest Reaper beat marker to t=10mins, and measure the distance between it and the onset of the corresponding audio beat. This distance represents the clock drift over 10 minutes.

95ms clock drift over 10 minutes at 125bpm
Negligable clock drift over 10 minutes at 125.02bpm

For 125BPM, the drift over 10 minutes is -95ms, giving me -9.5ms of drift per minute. (60000/59990.5)*125 = 125.02, so I set Reaper to 125.02BPM and the drift over 10 minutes becomes small enough to not be a problem any more. Unfortunately this has to be re-calculated for every BPM I set on the Pyramid. I figured out I can streamline this process by writing a C++ app that uses the RtMidi library to sample incoming MIDI clock pulses from the Pyramid’s USB output, calculating a rolling offset error to estimate drift from an expected BPM.

USB sampling setup

For 125BPM, the USB samples exhibit a clock drift of -1.1ms per minute, and I have to add a magic number of -8.4ms of drift per minute to match what I’m seeing when I line things up by hand in Reaper. I’ve tried this across multiple BPMs and the -8.4ms seems consistent (+/- 0.2ms). This method gives me reliable predictions for a BPM to use in Reaper to get the beat marks to line up with the audio, but the -8.4ms magic number is troubling.

Where is this magic -8.4ms coming from? I figure there are three clocks involved:

  1. Pyramid P
  2. My laptop L
  3. The USB audio module in the mixing console M

I suppose that the tweaked BPM in Reaper is driftPM (clock drift between Pyramid and mixer’s USB audio). My USB capture method is giving me driftPL. The magic -8.4ms must then be driftLM. So driftPM = driftPL + driftLM.

Does this seem correct? It appears to work in practise but I feel like I’m stabbing in the dark. Is there an easier approach?

Wouldn’t it be easier and more accurate to sync the Pyramid to Reaper over USB MIDI?

1 Like

Sure would! Reaper happily syncs to the Pyramid as long as it’s not recording, but as soon as I record audio, Reaper locks its timebase to the audio clock :frowning:

1 Like

Get expert sleepers and you will never look back at jitter or latency

Even if it’s just the usamo

But an ES8 is well recommended and ES3/5 with adat

m

Im confused…Are you just setting the clocks to the same BPM and not using any sort of sync?

Everything has midi drift…hardware…computers…even if you played the same thing on the same at different times the drift is going to be different.

In your particular set up if you set the computer as your master bpm and hook a usb to the pyramid you can sync the clock over usb. Computers like to be the master and you will have less problems with the computer as the master but you could also sync the computer the an external clock.

there is no sync without sync.

I’m not setting them to exactly the same BPM. The Pyramid is set to 128 BPM, Reaper is set to 128.042 BPM (which I work out using the method I describe above). Reaper starts recording when it gets a MIDI Play message from the Pyramid, so it starts basically in sync. There is still some drift like this but it’s <1ms per couple of minutes of recording and I can live with that.

Does it not work when you use the computer as your master clock and send clock to the pyramid over usb? I don’t use reaper but use Ableton and have no issues with the sync.

i tried but it just sounded wonky and drunk