Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increasing clock precision #257

Open
giohappy opened this issue Jan 5, 2021 · 4 comments
Open

Increasing clock precision #257

giohappy opened this issue Jan 5, 2021 · 4 comments

Comments

@giohappy
Copy link

giohappy commented Jan 5, 2021

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 giohappy changed the title Increase clock precision Increasing clock precision Jan 5, 2021
@neauoire
Copy link
Member

neauoire commented Jan 5, 2021

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?

@giohappy
Copy link
Author

giohappy commented Jan 5, 2021

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.

@boonier
Copy link

boonier commented Dec 12, 2022

@giohappy hey did anything good come out of this?

@giohappy
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants