Skip to main content
Version: Next

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.

Constructor

constructor(context: BaseAudioContext, options?: ChannelSplitterOptions)

ChannelSplitterOptions

Inherits all properties from AudioNodeOptions.

ParameterTypeDefault
numberOfOutputs
Optional
number6Number of outputs to split into. Must be in the range 132.

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.

AudioNodeproperties

ChannelSplitterNode does not define any additional properties.

Methods

Inherits all methods from AudioNode.

AudioNodemethods

ChannelSplitterNode does not define any additional methods.

Remarks

numberOfOutputs

  • Default value is 6.
  • Nominal range is 132. Values outside this range throw an IndexSizeError.
  • Cannot be changed after construction.

Channel configuration

  • channelCount equals numberOfOutputs, channelCountMode is fixed at explicit, and channelInterpretation is fixed at discrete. Attempts to change them throw an error.
  • Use the output argument of connect to target a specific channel, e.g. splitter.connect(node, 1) routes channel 1 downstream.
  • An output whose corresponding input channel does not exist emits a single channel of silence.