Orca icon indicating copy to clipboard operation
Orca copied to clipboard

Increasing clock precision

Open giohappy opened this issue 5 years ago • 4 comments

Testing the MIDI Clock with Reaper and Bitwig I've noticed that it has jitters and it's slightly offest. E.g. 110 bpm results in values jumping around 110.3/110.4 inside the DAWs. This is expected when setInterval is used, even if the main clock ticks inside a WebWorker.

Have you ever considered a solution where the clock ticks on the base of time measured with performance.now()? A setInterval callback might be set to run, let's say, every 5ms, but a time "integrator" could use performance time to decide when a tick should actually trigger.

From my tests (with an infinite loop in my case) using performance to decide when to send the MIDI clock pulses I can get a stable and reliable bpm in my DAWs.

giohappy avatar Jan 05 '21 22:01 giohappy

I'd be curious to see your implementation, I implemented that one point but it affected the performance a lot(CPU spiked), I have a slow computer, did you notice that it affected the performance a lot?

neauoire avatar Jan 05 '21 22:01 neauoire

I haven't done a performance test yet, but I will. I also want to test the AudioContext clock as an alternative.

My idea looks pretty similar to this blog post, but I will investigate more and, hopefully, share a proof of concept if anything good comes out.

giohappy avatar Jan 05 '21 23:01 giohappy

@giohappy hey did anything good come out of this?

boonier avatar Dec 12 '22 09:12 boonier

@boonier I didn't have the chance to move this forward.

giohappy avatar Dec 15 '22 16:12 giohappy