wild-web-midi icon indicating copy to clipboard operation
wild-web-midi copied to clipboard

sound lagging when changing tab

Open yazgoo opened this issue 9 years ago • 4 comments

When I play a song and change tab, the sound is lagging. Any idea on how to fix this ?

yazgoo avatar Sep 26 '16 11:09 yazgoo

Looks like when this happens, I get these messages in the console:

buffer under run!!

yazgoo avatar Sep 26 '16 11:09 yazgoo

Looks like that increasing CircularAudioBuffer size does the trick for a little while, then it lags again.

yazgoo avatar Sep 26 '16 11:09 yazgoo

I guess that increasing the circularbuffer size only makes wildmidi fill it when the tab has the focus. The problems seems to come from wildmidi processAudio which is not called fast enough, maybe using webworkers could help ?

yazgoo avatar Sep 27 '16 18:09 yazgoo

This is a limitation of web browser - they throttle cpu usage when a tab is backgrounded

The workarounds are 1) move it to a new window instead of a new tab, 2) pause the music if the tab is backgrounded

zz85 avatar Jun 13 '17 18:06 zz85