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

Creating Too Many Sounds Mutes Audio #53

Closed
epiqueras opened this issue Mar 29, 2017 · 8 comments
Closed

Creating Too Many Sounds Mutes Audio #53

epiqueras opened this issue Mar 29, 2017 · 8 comments

Comments

@epiqueras
Copy link

Hello,

I am creating a lot of sounds, each with their own effects. When their settings change, I create new sounds instead of modifying the existing ones. After the second settings change, all sounds stop playing with no errors printed to the console.

I think that this is due to the amount of sounds being created, and Pizzicato holding on to them even though I stopped referencing them in my code. Is there any way I can clear unused sounds from the audio context?

@JohnPaulHarold
Copy link
Contributor

@epiqueras can you provide code demonstrating what you are trying to achieve. Pastebin or something?

@epiqueras
Copy link
Author

@JohnPaulHarold
Copy link
Contributor

@epiqueras you hit a limit < 1000 in Chrome, and < 100 in Firefox, so this may well be hitting browser limits. I was certainly close to requiring to terminate my Chrome instance when trying 10000. What is the use case for this many concurrent Sound objects?

@epiqueras
Copy link
Author

@JohnPaulHarold

It's an audio editing application with many concurrent Sound objects that you can configure.
So the browser can't handle too many attached sound objects? is there a method for detaching them?

@JohnPaulHarold
Copy link
Contributor

@epiqueras it might be worth trying similar tests using the WebAudio API directly and see if the issue is due to Pz or that you're simply running into limits with the browsers.

@alemangui
Copy link
Owner

alemangui commented Apr 2, 2017

Hey, I've played around with https://repl.it/GnTO.

There seems to be a memory limitation. In order to free up a Pizzicato.Sound object, I recommend that you call the disconnect function on it. This will remove the connection of the sound to the context's output, leaving it as an orphan graph and thus being cleaned when necessary.

An example of this can be found at https://jsfiddle.net/bdbz0mvx/ - where I am creating 50k Pizzicato Sounds but calling disconnect on the previous one. Do you get the same result? (i.e., sound playing).

@epiqueras would this be an acceptable work around in your use case?

@epiqueras
Copy link
Author

@alemangui
That fixed it. Thanks!
https://repl.it/GnTO/latest

Maybe this should be added to the docs?

@alemangui
Copy link
Owner

Yes definitely, I'll leave the issue open until I add the memory section to the docs.

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

3 participants