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
AudioNodeto disconnect from. - Output (optional)
- An index describing which output of the current
AudioNodeyou 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, anINDEX_SIZE_ERRexception is thrown. - Input (optional)
- An index describing which input of the given destination
AudioNodeyou 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, anINDEX_SIZE_ERRexception 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 |