The disconnect() method of the AudioNode interface lets you disconnect one or more nodes from the node on which the method is called.





AudioNode.disconnect(destination, output);

AudioNode.disconnect(destination, output, input);

Return value



There are several versions of the disconnect() method, which accept different combinations of parameters to control which nodes to disconnect from.

destination Optional
An AudioNode or AudioParam specifying the node or nodes to disconnect from. If this value is an AudioNode, a single node is disconnected from, with any other, optional, parameters (output and/or input) further limiting which inputs and/or outputs should be disconnected. If this value is an AudioParam, then the connection to that AudioParam is terminated, and the node's contributions to that computed parameter become 0 going forward once the change takes effect. If no matching connection is found, an InvalidAccessError exception is thrown.
output Optional
An index describing which output from the current AudioNode is to be disconnected. The index numbers are defined according to the number of output channels (see Audio channels). If this parameter is out-of-bound, an IndexSizeError exception is thrown.
input Optional
An index describing which input into the specified destination AudioNode is to be disconnected. The index numbers are defined according to the number of input channels (see Audio channels).  If this parameter is out-of-bound, an IndexSizeError exception is thrown.


A value specified for input or output is invalid, referring to a node which doesn't exist or outside the permitted range.
The node on which disconnect() was called isn't connected to the specified destination node.


var AudioContext = window.AudioContext || window.webkitAudioContext;

var audioCtx = new AudioContext();

var oscillator = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();




Specification Status Comment
Web Audio API
The definition of 'disconnect' in that specification.
Working Draft  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 10.0webkit 25 (25) No support 15.0webkit
22 (unprefixed)
destination and input parameters 43.0 No support ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support ? ? 25.0 (25) 1.2 ? ? ? ?
destination and input parameters No support No support No support No support ? ? ? 43.0

See also


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

API audio Audio AudioNode Disconnect Method Reference Web Audio API