Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

AudioNode.connect(AudioNode)

The connect method of the AudioNode interface allows you to connect one output of the current node to one input of another node.

Syntax

var AudioNode = AudioNode.connect(destination, output, input)

Parameters

destination
The AudioNode you are connecting to.
output Optional
An index describing which output of the current AudioNode you want to connect to the destination. 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. It is possible to connect an AudioNode output to more than one input with multiple calls to connect(). Therefore fan-out is supported.
input Optional
An index describing which input of the destination you want to connect the current AudioNode to. 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. It is possible to connect an AudioNode to another AudioNode, which in turn connects back to the first AudioNode, creating a cycle. This is allowed only if there is at least one DelayNode in the cycle. Otherwise, a NOT_SUPPORTED_ERR exception will be thrown.

Returns

A reference to the destination AudioNode object. In some browsers older implementations of this interface return void.

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

Specifications

Specification Status Comment
Web Audio API
The definition of 'connect(AudioNode)' 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 (Yes)
Unprefixed (Yes)     22  
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support ? ? 26.0 1.2 ? ? ? ?
Unprefixed ? (Yes)           (Yes)

See also

Document Tags and Contributors

 Contributors to this page: Jib, jpmedley, fscholz, chrisdavidmills
 Last updated by: Jib,