Search code examples
javascriptweb-audio-api

Are automation events on nodes canceled on node disconnect?


I'm disconnecting audio nodes (GainNode, StereoPannerNode) and reusing them later in another situation at another time (to reduce GC activity). Should I cancel all automation events on AudioParams of the node (should I call for example node.gain.cancelScheduledValues()) or it's done automatically when calling node.disconnect()?

I didn't find any details in the documentation at MDN, so I assume the AudioParams may still be changing after a node is disconnected.


Solution

  • That's a very good question. Since the WebAudio spec doesn't say, I think it's best to assume that the automations are still in place. If you don't want that, you need to cancel any automations before you reconnect them.