when a user clicks on a button a sound is played , and if he clicks it again a new instance of that same sound is played .
i do that by connecting a new source node to the audio Context on every click.
now say that user clicks the button for 1 hour , does every source node that has finished playing gets deleted or it stays connected to the audio Context ?
Here are the relevant specs:
So in the case of for instance, an AudioBufferSourceNode, since it has no input(3), no tail-time(4), is not linked to an external MediaStream(5) or MediaElement(6), if you don't keep any reference to the node in your js code(1), and that the Node has finished playing(2), then it can be removed from the graph, and then Garbage Collected.
Also note that most source nodes have a very little fingerprint anyway.
If once again we take AudioBufferSourceNodes as an example, then you have to understand that they don't duplicate the AudioBuffer, they just reference it.
So creating thousands of AudioBufferSourceNodes from the same AudioBuffer is fine.
However creating thousands of AudioBuffers from the same ArrayBuffer, or thousands of ArrayBuffers from the same file, or both is not fine at all, so be sure that when you are handling the click event all you do is create a new AudioBufferSourceNode, from a preexisting AudioBuffer.