Skip to main content

Mixing and Splitting Audio

Working with audio signals inevitably leads to the need of mixing and splitting the signals. Whether you want to route a signal to distinct effect chains or mix different audio players and inputs, Switchboard SDK can help you with that. The specific nodes take care of the various use-cases you might encounter.

Important Terminology:

  • Audio bus: A stream of audio that goes into or comes out of a node. It encapsulates one or more channels of audio.

Nodes for Mixing Audio

Mixing Audio Buses

The MixerNode has two or more input audio buses that are mixed together in a single output audio bus with equal magnitude. The input and output audio bus channel numbers must match.

Using the MixerNode Class

{
"nodes": {
{ "id": "audioPlayerNode", "type": "AudioPlayerNode" },
{ "id": "mixerNode", "type": "MixerNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "mixerNode" },
{ "sourceNode": "audioPlayerNode", "destinationNode": "mixerNode" },
{ "sourceNode": "mixerNode", "destinationNode": "outputNode" }
}
}

For more information take a look at the Mixing


Mixing Audio Channels

The MultiChannelToMonoNode has a single multichannel input audio bus and a single mono output audio bus. The channels of the input audio bus are mixed to mono with equal magnitude and normalized to 0 dBFS to avoid clipping.

Using the MultiChannelToMonoNode Class

{
"nodes": {
{ "id": "multiChannelToMonoNode", "type": "MultiChannelToMonoNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "multiChannelToMonoNode" },
{ "sourceNode": "multiChannelToMonoNode", "destinationNode": "outputNode" }
}
}

Merging Audio Buses

The MonoBusMergerNode has multiple mono input audio buses and a single output audio bus that has multiple channels matching the number of input audio buses. The channels of the input audio buses are merged into the output audio bus unaltered.

Using the MonoBusMergerNode Class

{
"nodes": {
{ "id": "monoPlayerNode", "type": "AudioPlayerNode" },
{ "id": "monoBusMergerNode", "type": "MonoBusMergerNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "monoBusMergerNode" },
{ "sourceNode": "monoPlayerNode", "destinationNode": "monoBusMergerNode" },
{ "sourceNode": "monoBusMergerNode", "destinationNode": "outputNode" }
}
}

The StereoBusMergerNode has multiple stereo input audio buses and a single output audio bus that has multiple channels matching the number of input audio buses multiplied by two for the stereo input. The channels of the input audio buses are merged into the output audio bus unaltered.

Using the StereoBusMergerNode Class

{
"nodes": {
{ "id": "stereoPlayerNode", "type": "AudioPlayerNode" },
{ "id": "stereoBusMergerNode", "type": "StereoBusMergerNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "stereoBusMergerNode" },
{ "sourceNode": "stereoPlayerNode", "destinationNode": "stereoBusMergerNode" },
{ "sourceNode": "stereoBusMergerNode", "destinationNode": "outputNode" }
}
}

Selecting and Forwarding an Audio Bus

The BusSelectNode has multiple input audio buses and a single output audio bus. An input audio bus can be selected and forwarded to the output audio bus. The number of channels of the input and output audio buses must match.

Using the BusSelectNode Class

{
"nodes": {
{ "id": "audioPlayerNode", "type": "AudioPlayerNode" },
{ "id": "busSelectNode", "type": "BusSelectNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "busSelectNode" },
{ "sourceNode": "audioPlayerNode", "destinationNode": "busSelectNode" },
{ "sourceNode": "busSelectNode", "destinationNode": "outputNode" }
}
}

Forwarding a single input bus to a single output bus out from multiple output buses

The BusSwitchNode has a single input audio bus and multiple output audio buses. An output audio bus can be selected and the input audio bus forwarded to the selected output audio bus. The number of channels of the input and output audio buses must match.

Using the BusSwitchNode Class

{
"nodes": {
{ "id": "busSwitchNode", "type": "BusSwitchNode" },
{ "id": "vuMeterNode", "type": "VUMeterNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "busSwitchNode" },
{ "sourceNode": "busSwitchNode", "destinationNode": "vuMeterNode" },
{ "sourceNode": "busSwitchNode", "destinationNode": "outputNode" }
}
}

Nodes for Splitting Audio

Splitting Audio Buses

The SplitterNode has a single input audio bus and multiple output audio buses. The input audio bus is forwarded to every output audio bus. The number of channels of the input and output audio buses must match.

Using the BusSplitterNode Class

{
"nodes": {
{ "id": "splitterNode", "type": "BusSplitterNode" },
{ "id": "recorderNode", "type": "RecorderNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "splitterNode" },
{ "sourceNode": "splitterNode", "destinationNode": "recorderNode" },
{ "sourceNode": "splitterNode", "destinationNode": "outputNode" }
}
}

Splitting Audio Channels into a Single Audio Bus

The MonoToMultiChannelNode has a single mono input audio bus and a single multichannel output audio bus. The mono channel of the input audio bus is forwarded to every channel of the output audio bus.

Using the MonoToMultiChannelNode Class

{
"nodes": {
{ "id": "monoAudioPlayerNode", "type": "AudioPlayerNode" },
{ "id": "monoToMultiChannelNode", "type": "MonoToMultiChannelNode" }
},
"connections": {
{ "sourceNode": "monoAudioPlayerNode", "destinationNode": "monoToMultiChannelNode" },
{ "sourceNode": "monoToMultiChannelNode", "destinationNode": "outputNode" }
}
}

Splitting Audio Channels to Separate Audio Buses

The ChannelSplitterNode has a single multichannel input audio bus and multiple mono output audio buses. The channels of the input audio bus are split to the separate output audio buses. The number of output audio buses must match the number of channels of the input bus.

Using the ChannelSplitterNode Class

{
"nodes": {
{ "id": "channelSplitterNode", "type": "ChannelSplitterNode" },
{ "id": "leftVUMeterNode", "type": "VUMeterNode" },
{ "id": "rightVUMeterNode", "type": "VUMeterNode" }
},
"connections": {
{ "sourceNode": "inputNode", "destinationNode": "channelSplitterNode" },
{ "sourceNode": "channelSplitterNode", "destinationNode": "leftVUMeterNode" },
{ "sourceNode": "channelSplitterNode", "destinationNode": "rightVUMeterNode" }
}
}