smfplayer icon indicating copy to clipboard operation
smfplayer copied to clipboard

Latency is not always predictable

Open ThePianoGuy opened this issue 5 years ago • 0 comments

Hello, and first let me thank everyone involved for this wonderful project. I have been having a great time experimenting with it.

I'm trying to play a MIDI file and an MP3 file at the same time. The purpose is to play music and run a MIDI-controlled lighting system with lights synced to the music.

This is what I have come up with: https://kfatheatre.com/pub/midi-demo/ . When all is working properly, you should hear the midi and MP3 simultaneously.

The problem is the latency is not always predictable. It can vary by up to 100ms. If both files start at the same time, they seem to stay in sync for the duration of the song, but, I never know what latency to start with.

If anyone has any suggestions for how to keep the two files in sync, (perhaps a setInterval that corrected the position throughout the song? would that work?) I would be delighted to know.

ThePianoGuy avatar Jun 07 '19 17:06 ThePianoGuy