scrime-u-bordeaux / web-midifile-performer

a web version of the midifile performer software
0 stars 0 forks source link

Place audio playback logic in a WebWorker to avoid playback slowdowns #111

Open NyuBlara opened 2 weeks ago

NyuBlara commented 2 weeks ago

Audio playback is slowed down by anything happening in the UI thread. This is very often the case with the SheetMusic visualizer's logic (#101), but can also happen for any number of reasons ; resources are fluctuating in nature.

Thus, perhaps it would be better to isolate audio playback in its own thread, so that its setTimeouts are never delayed by UI thread events.

NyuBlara commented 2 weeks ago

I tried isolating setTimeout to its own worker in a branch, but it seems to have no effect. It also creates a hard-to-reproduce bug where sometimes playback becomes super-fast and impossible to stop. So this might not be the solution after all...but then, where do these delays come from ? They weren't there before visualizers were implemented.