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

No buffer for note error when using Tone.Sampler onload to track readiness to play #1276

Open
utanashati opened this issue Sep 16, 2024 · 0 comments

Comments

@utanashati
Copy link

utanashati commented Sep 16, 2024

Describe the bug

I'm using Tone.Sampler within a React app to play notes on the keyboard. I'm using the onload constructor param to track when the sampler is ready to play, and enable my keyboard based on this. However, I noticed that when I play a note right after the keyboard gets enabled (by spamming the taps, for example), I get a buffer error: Error: No available buffers for note: 60.

I've tried it in Safari and Firefox, both seem to have this issue, Firefox less frequently.

When I put a small timeout on setting the loading state of a sampler, I can eliminate this behaviour, but ideally I would like to not rely on hardcoded timeouts.

To Reproduce

Here's a codesandbox example.

Expected behavior
I would expect the onload to allow to reliably set loading state to false.

What I've tried

When I put a small timeout on setting the loading state of a sampler, I can eliminate this behaviour, but ideally I would like to not rely on hardcoded timeouts.

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

No branches or pull requests

1 participant