AudioNode.disconnect()

This article needs a technical review. How you can help.

The disconnect method of the AudioNode interface allows you to disconnect the current node from another one that it is already connected to.

SyntaxEdit

oscillator.connect(audioCtx.destination);
oscillator.disconnect();

Returns

Void.

Parameters

Destination (optional)
A specific AudioNode to disconnect from.
Output (optional)
An index describing which output of the current AudioNode you want to disconnect. The index numbers are defined according to the number of output channels (see Audio channels).  If this parameter is out-of-bound, an INDEX_SIZE_ERR exception is thrown.
Input (optional)
An index describing which input of the given destination AudioNode you want to disconnect. The index numbers are defined according to the number of input channels (see Audio channels).  If this parameter is out-of-bound, an INDEX_SIZE_ERR exception is thrown.

ExampleEdit

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

var audioCtx = new AudioContext();

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

oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);

gainNode.disconnect();

SpecificationsEdit

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

Browser compatibilityEdit

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 10.0webkit 25.0 (25.0) Not supported 15.0webkit
22 (unprefixed)
(Yes)
Destination and Input parameters 43.0 ? ? ? ?

See alsoEdit

Using the Web Audio API

Document Tags and Contributors

 Contributors to this page: 1j01, Yukulele., Jeremie, jpmedley, fscholz, padenot, chrisdavidmills
 Last updated by: 1j01,