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:
Name | Number of channels | Channels |
---|---|---|
Mono | 1 | 0: M - mono |
Stereo | 2 | 0: L - left 1: R - right |
Quad | 4 | 0: L - left 1: R - right 2: SL - surround left 3: SR - surround right |
Stereo | 6 | 0: 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
Name | Type | Description | |
---|---|---|---|
context | BaseAudioContext | Associated context. | Read only |
numberOfInputs | number | Integer value representing the number of input connections for the node. | Read only |
numberOfOutputs | number | Integer value representing the number of output connections for the node. | Read only |
channelCount | number | Integer used to determine how many channels are used when up-mixing or down-mixing node's inputs. | Read only |
channelCountMode | ChannelCountMode | Enumerated value that specifies the method by which channels are mixed between the node's inputs and outputs. | Read only |
channelInterpretation | ChannelInterpretation | Enumerated 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.
Parameters | Type | Description |
---|---|---|
destination | AudioNode | AudioNode to which to connect. |
Errors:
Error type | Description |
---|---|
InvalidAccessError | If 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.
Parameters | Type | Description |
---|---|---|
destination Optional | AudioNode | AudioNode 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.