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

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

Open
NyuBlara opened this issue Oct 30, 2024 · 2 comments
Open
Labels
improvement Something suboptimal to make better

Comments

@NyuBlara
Copy link
Collaborator

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
Copy link
Collaborator Author

NyuBlara commented Nov 5, 2024

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.

@NyuBlara
Copy link
Collaborator Author

The "super-fast playback" bug is probably solved with #127 (which forces clearTimeout() on every new call of playNextSet()), but still, use of a worker doesn't seem to result in any performance improvements.

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

No branches or pull requests

1 participant