ChannelMergerNode
The ChannelMergerNode interface combines multiple mono inputs into a single output whose channels correspond, in order, to the node's inputs. It is an AudioNode with a variable number of single-channel inputs and one output.
Each input is treated as a single channel: the signal connected to input i becomes channel i of the output. This is the counterpart of ChannelSplitterNode.
Constructor
constructor(context: BaseAudioContext, options?: ChannelMergerOptions)
ChannelMergerOptions
Inherits all properties from AudioNodeOptions.
| Parameter | Type | Default | |
|---|---|---|---|
numberOfInputs Optional | number | 6 | Number of inputs to merge. Must be in the range 1 – 32. |
You can also create a ChannelMergerNode via the BaseAudioContext.createChannelMerger(numberOfInputs?: number) factory method, which uses default values when called without arguments.
Example
import { AudioContext } from 'react-native-audio-api';
const ctx = new AudioContext();
const merger = ctx.createChannelMerger(2);
const left = ctx.createOscillator();
const right = ctx.createOscillator();
left.connect(merger, 0, 0);
right.connect(merger, 0, 1);
merger.connect(ctx.destination);
Properties
Inherits all properties from AudioNode.
AudioNodepropertiesChannelMergerNode does not define any additional properties.
Methods
Inherits all methods from AudioNode.
AudioNodemethodsChannelMergerNode does not define any additional methods.
Remarks
numberOfInputs
- Default value is
6. - Nominal range is
1–32. Values outside this range throw anIndexSizeError. - Cannot be changed after construction.
Channel configuration
channelCountis fixed at1andchannelCountModeis fixed atexplicit. Attempts to change them throw an error.- Use the
inputargument ofconnectto target a specific input, e.g.source.connect(merger, 0, 2)routes into channel2.