ChannelSplitterNode
The ChannelSplitterNode interface separates the individual channels of an audio signal into a set of mono outputs. It is an AudioNode with a single input and a variable number of single-channel outputs.
Channel i of the input signal is exposed on output i. This is the counterpart of ChannelMergerNode.
Press play, then click either box to bypass the pair and hear the original stereo image again. The default sample carries the voice in the left channel and the music in the right, so each routing choice is easy to place, and the meters show what reaches each speaker.
Constructor
constructor(context: BaseAudioContext, options?: ChannelSplitterOptions)
ChannelSplitterOptions
Inherits all properties from AudioNodeOptions.
| Parameter | Type | Default | |
|---|---|---|---|
numberOfOutputs Optional | number | 6 | Number of outputs to split into. Must be in the range 1 – 32. |
You can also create a ChannelSplitterNode via the BaseAudioContext.createChannelSplitter(numberOfOutputs?: number) factory method, which uses default values when called without arguments.
Example
import { AudioContext } from 'react-native-audio-api';
const ctx = new AudioContext();
const splitter = ctx.createChannelSplitter(2);
source.connect(splitter);
const leftGain = ctx.createGain();
const rightGain = ctx.createGain();
splitter.connect(leftGain, 0);
splitter.connect(rightGain, 1);
Properties
Inherits all properties from AudioNode.
AudioNodepropertiesChannelSplitterNode does not define any additional properties.
Methods
Inherits all methods from AudioNode.
AudioNodemethodsChannelSplitterNode does not define any additional methods.
Remarks
numberOfOutputs
- Default value is
6. - Nominal range is
1–32. Values outside this range throw anIndexSizeError. - Cannot be changed after construction.
Channel configuration
channelCountequalsnumberOfOutputs,channelCountModeis fixed atexplicit, andchannelInterpretationis fixed atdiscrete. Attempts to change them throw an error.- Use the
outputargument ofconnectto target a specific channel, e.g.splitter.connect(node, 1)routes channel1downstream. - An output whose corresponding input channel does not exist emits a single channel of silence.