Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

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.

Syntax

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.

Example

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();

Specifications

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.0 (25.0) Not supported 15.0webkit
22 (unprefixed)
(Yes)
Destination and Input parameters 43.0 ? ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support ? ? 25.0 1.2 ? ? ? ?
Destination and Input parameters Not supported Not supported ? ? ? ? ? 43.0

See also

Using the Web Audio API

Document Tags and Contributors

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