1

So I have a web app I'm building that has several different possible sounds that can be triggered by a button press. Something like a radio list of options and you choose your option and then hit the play button and it plays.

previously with only 2 sources, I created the entire web audio pathway (oscillator > gain > pan > destination) and then started the oscillator and just changed the with the gain node to turn on and off different sounds. It seems like a bad idea though to have 6 web audio sources always running (but with two of them at 0 gain).

So my question is this: Is it better to run 6 sources, and toggle the gain node for the one or two I want to be on and the other two to be 0 (to "turn them off"), or is it better to start and stop the different oscillator nodes (leaving them for garbage collection) on each cycle.

In a given session, a user may create hundreds of little boops and beeps at different frequencies - so it feels like trouble to control creating and destroying each one. But at the same time, I don't want my apps performance to suffer by constantly running 6 web audio sources in the background.

Any thoughts or ideas?

shaedopotato
  • 457
  • 1
  • 3
  • 12
  • In today's world every PC comes with at least 8GB of RAM... For audio channels, even 100 of them won't fill the RAM. Of course, if your app is built to run 24-7 for several days, then it could be interesting to wipe the channels correctly. – E-telier Mar 11 '22 at 22:55

0 Answers0