Skip to main content

AudioNode

The AudioNode interface serves as a versatile interface for constructing an audio processing graph, representing individual units of audio processing functionality. Each AudioNode is associated with a certain number of audio channels that facilitate the transfer of audio data through processing graph.

We usually represent the channels with the standard abbreviations detailed in the table below:

NameNumber of channelsChannels
Mono10: M - mono
Stereo20: L - left
1: R - right
Quad40: L - left
1: R - right
2: SL - surround left
3: SR - surround right
Stereo60: L - left
1: R - right
2: C - center
3: LFE - subwoofer
4: SL - surround left
5: SR - surround right

Mixing

When node has more then one input or number of inputs channels differs from output up-mixing or down-mixing must be conducted. There are three properties involved in mixing process: channelCount, ChannelCountMode, ChannelInterpretation. Based on them we can obtain output's number of channels and mixing strategy.

Properties

NameTypeDescription
contextBaseAudioContextAssociated context.
Read only
numberOfInputsnumberInteger value representing the number of input connections for the node.
Read only
numberOfOutputsnumberInteger value representing the number of output connections for the node.
Read only
channelCountnumberInteger used to determine how many channels are used when up-mixing or down-mixing node's inputs.
Read only
channelCountModeChannelCountModeEnumerated value that specifies the method by which channels are mixed between the node's inputs and outputs.
Read only
channelInterpretationChannelInterpretationEnumerated value that specifies how input channels are mapped to output channels when number of them is different.
Read only

Methods

connect

The above method lets you connect one of the node's outputs to a destination.

ParametersTypeDescription
destinationAudioNodeAudioNode to which to connect.

Errors:

Error typeDescription
InvalidAccessErrorIf destination is not part of the same audio context as the node.

Returns undefined.

disconnect

The above method lets you disconnect one or more nodes from the node.

ParametersTypeDescription
destination
Optional
AudioNodeAudioNode to which to connect.

If no arguments provided node disconnects from all outgoing connections.

Returns undefined.

Remarks

numberOfInputs

  • Source nodes are characterized by having a numberOfInputs value of 0.

numberOfOutputs

  • Destination nodes are characterized by having a numberOfOutputs value of 0.