Connecting Nodes
To build an audio engine with Switchboard SDK, you connect nodes together in an audio graph. This lets you design flexible and powerful audio processing pipelines.
Audio Graphs
Switchboard SDK uses the audio graph paradigm: a data structure representing a collection of audio processing nodes and the connections between them. Each node performs a specific function (such as generating, processing, or consuming audio), and nodes are connected by audio buses, which carry audio data between them.
Audio graphs allow for flexible routing and re-routing of audio signals, making it easy to build complex signal chains, effect racks, or even digital audio workstations (DAWs). You can connect, disconnect, and rearrange nodes, change their parameters, and monitor audio at any point in the graph.
Learn more about the AudioGraph object.
Mixing and Splitting Audio
Splitting a Single Output to Multiple Inputs
If you want to send the same audio signal to multiple destinations (for example, to both a recorder and the speakers), use the BusSplitter
node. This node takes a single input and duplicates it to multiple outputs.
When to use:
- Sending the same audio to multiple effects or destinations.
- Parallel processing or monitoring.
Mixing Multiple Inputs to a Single Output
To combine several audio signals into one, use the Mixer
node. It takes two or more input buses and mixes them together into a single output bus.
When to use:
- Mixing music and voice.
- Combining multiple tracks or sources.
Matching Audio Formats
When connecting nodes, their audio formats (number of channels, sample rate, buffer size) must be compatible. If not, you may need to insert format-conversion nodes.
Number of Channels
-
Stereo to Mono:
UseMultiChannelToMono
to downmix a multichannel signal to mono. -
Mono to Stereo (or Multichannel):
UseMonoToMultiChannel
to upmix a mono signal to multiple channels.
When to use:
- Connecting a mono source to a stereo effect.
- Downmixing a stereo track for analysis or output.
Sample Rates and Buffer Sizes
You can set a custom sample rate and buffer size on the audio graph. This ensures the graph performs resampling and buffer resizing as needed.
If you need to embed a node with a different sample rate, use:
ResampledSink
: Receives audio and resamples it for an embedded node.ResampledSource
: Outputs audio resampled from an embedded node.
When to use:
- Integrating nodes or subgraphs with different sample rates.
- Ensuring compatibility between external sources and your graph.
For more advanced routing, see Subgraphs.
Merging Audio Buses
-
MonoBusMerger:
UseMonoBusMerger
to merge multiple mono input buses into a single multichannel output bus. -
StereoBusMerger:
UseStereoBusMerger
to merge multiple stereo input buses into a single multichannel output bus.
When to use:
- Combining several mono or stereo sources into a multichannel bus for further processing.
Selecting and Forwarding an Audio Bus
- BusSelect:
UseBusSelect
to select one of several input buses and forward it to the output.
When to use:
- Switching between different sources (e.g., microphone vs. music) dynamically.
Switching Audio Buses
- BusSwitch:
UseBusSwitch
to forward a single input bus to one of several output buses, based on selection.
When to use:
- Routing a signal to different destinations (e.g., output, recorder, effect chain) on demand.
Splitting Audio Channels
- ChannelSplitter:
UseChannelSplitter
to split a multichannel input into separate mono output buses.
When to use:
- Processing or analyzing individual channels separately (e.g., left/right, surround channels).
Summary
- Use splitters to duplicate signals, mixers to combine them.
- Use mergers to combine multiple buses into one.
- Use selectors and switches to route signals dynamically.
- Use format converters (e.g., mono/stereo, resamplers) to ensure compatibility.
- Use channel splitters to process channels individually.
For a full list of nodes and their documentation, see the List of Objects page.