mozilla
Your Search Results

    AudioNode.connect(AudioNode)

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

    Syntax

    var oscillator = audioCtx.createOscillator();
    oscillator.connect(audioCtx.destination,1,1);

    Returns

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

    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, or a NOT_SUPPORTED_ERR exception will be thrown.

    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
    22 (unprefixed)
    (Yes)
    Feature Android Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile
    Basic support ? 26.0 1.2 ? ? ?

    See also

    Document Tags and Contributors

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