nodi icon indicating copy to clipboard operation
nodi copied to clipboard

Time drift during MIDI playback

Open mdwn opened this issue 9 months ago • 2 comments

For context: I am writing https://github.com/mdwn/mtrack, and I am playing a MIDI track into a MIDI to DMX translator against a click track.

As I was testing playback, I noticed that the lights were slowly getting behind the beat of the click. After doing some digging, I believe the issue lies here: https://github.com/insomnimus/nodi/blob/main/src/player.rs#L45. The sleep is accurate, however, I think the writing of the events out using midir is adding in a slight latency per tick, which cumulatively becomes noticeable.

I was able to fix within my repo with this PR: https://github.com/mdwn/mtrack/pull/32. However, I suspect a better solution could be integrated directly into nodi. I'd be happy to submit a PR, but wanted to check with you first.

mdwn avatar May 14 '24 17:05 mdwn