Skip to main content

Switchboard SDK graph configuration

Overview

Switchboard SDK graphs can be defined with a single JSON configuration file. Defining the graph with JSON allows you to focus on building the rest of your application and not spend time working out how to connect the various pieces of you graph.

The configuration instructs the SDK which nodes to create from nodes array property, and how to connect them under the connections array property.

If a graph does not have a connections property defined, then all nodes will be connected sequencially, on their first audio input and output bus.

You can experiment with building your JSON configurations with our online editor, which usalises the WebAssembly version of the Switchboard SDK. If you'd like to use Switchboard on the web, please take a look at the integration guide.

Basic example

Let's take a look at a simple sine tone generator. Here, we simple add a OscillatorNode as a single item in our nodes array.

{
"nodes": [
{
"type": "WebAudio.Oscillator"
}
]
}

The example above will create a sine tone generator and connect it directly to the output device.

JSON configuration schema

Config

ConfigDescription
title: StringTitle of the audio lab.
nodes: ArrayList of audio node configs.
connections: ArrayList of connection configs. Optional. If this setting is not present, all nodes are connected sequentially.
presets: ArrayList of preset configs.
theme: ObjectTheme config.
tracks: ArrayList of track list configs. These tracks will be loaded into the player nodes.

Node Types

ConfigDescription
id: StringID of audio node. Optional. If not provided, a random ID will be generated for the node.
A user provided ID is required if the node needs to be referenced somewhere else in the config.
type: StringType for audio node. Can be:
UserInputSource: WebAudio input source node
OutputNode: WebAudio output node
uiConfig: ObjectConfig object for the node that controls how the node is displayed in the UI. (Optional)

WebAudio Node Types

ConfigDescription
id: StringID of audio node. Optional. If not provided, a random ID will be generated for the node.
A user provided ID is required if the node needs to be referenced somewhere else in the config.
type: StringType for audio node. Can be:
WebAudio.BufferSource: WebAudio Buffer Source Node
WebAudio.Gain: WebAudio Gain Node
WebAudio.BiquadFilter: WebAudio Biquad Filter Node
WebAudio.Delay: WebAudio Delay Node
WebAudio.DynamicsCompressor: WebAudio Dynamics Compressor Node
WebAudio.Oscillator: WebAudio Oscillator Node
WebAudio.UITesterNode: Node created for testing all UI controls.
uiConfig: ObjectConfig object for the node that controls how the node is displayed in the UI. (Optional)

Switchboard Node Types

ConfigDescription
id: StringID of audio node. Optional. If not provided, a random ID will be generated for the node.
A user provided ID is required if the node needs to be referenced somewhere else in the config.
type: StringType for audio node. Can be:
Switchboard.Chorus: Switchboard chorus effect
Switchboard.Delay: Switchboard delay effect
Switchboard.Flanger: Switchboard Flanger effect
Switchboard.Mixer: Switchboard Mixer, to add signals
Switchboard.MonoToMultiChannel: Switchboard utility to convert a mono signal to stereo
Switchboard.MusicDucking: Switchboard effect to turn down the the volume of audio bus one when a signal is detected on any subsequent audio buses
Superpowered.NoiseGate: Switchboard nosie gate efect which allows you to mute low level signals
Superpowered.PingPongDelay: Switchboard ping-pong delay effect
Switchboard.SineGenerator: Switchboard sine tone generator
Switchboard.Vibrato: Switchboard vibrato effect
Switchboard.VoiceActivityDetector: Detect when a speaking voice is detected above a certain threshold
Switchboard.VUMeter: Switchboard VU meter to show RMS and peak values
Switchboard.WhiteNoiseGenerator: Switchboard white noise generator
uiConfig: ObjectConfig object for the node that controls how the node is displayed in the UI. (Optional)

Superpowered Node Types

ConfigDescription
id: StringID of audio node. Optional. If not provided, a random ID will be generated for the node.
A user provided ID is required if the node needs to be referenced somewhere else in the config.
type: StringType for audio node. Can be:
Superpowered.AdvancedAudioPlayer: Superpowered AdvancedAudioPlayer
Superpowered.AutomaticVocalPitchCorrection: Superpowered AdvancedAudioPlayer, aka Autotuning
Superpowered.Echo: Superpowered Echo
Superpowered.Filter: Superpowered Filter
Superpowered.Flanger: Superpowered Flanger
Superpowered.Compressor: Superpowered Compressor
Superpowered.Oscillator: Superpowered Oscillator
Superpowered.Reverb: Superpowered Reverb
uiConfig: ObjectConfig object for the node that controls how the node is displayed in the UI. (Optional)

RNNoise Node Types

ConfigDescription
id: StringID of audio node. Optional. If not provided, a random ID will be generated for the node.
A user provided ID is required if the node needs to be referenced somewhere else in the config.
type: StringType for audio node. Can be:
RNNoise.NoiseFilter: RNNoise Nosie Filter
uiConfig: ObjectConfig object for the node that controls how the node is displayed in the UI. (Optional)

Connection Config

ConfigDescription
sourceNode: StringSource node ID.
sourceBusIndex: IntSource node bus index. Optional. Default: 0
destinationNode: StringDestination node ID.
"outputNode" can be used for the implicitly created output node.
destinationBusIndex: IntDestination node bus index. Optional. Default: 0

Node UI Config

ConfigDescription
title: StringTitle of the audio node.
tracks: ArrayList of track config objects.
position: ObjectOptional position config object for the audio node.
showHandleIndexes: BooleanShows bus number labels. Default false

Track Config

ConfigDescription
label: StringLabel for sample.
url: StringURL of sample.

Position Config

If no positon config object is supplied, the audio graph will auto layout.

ConfigDescription
x: NumberX coordinate.
y: NumberY coordinate.

Preset Config

ConfigDescription
name: StringName of preset.
nodes: ObjectList of parameter config arrays keyed by node ID.

Track List Config

ConfigDescription
label: StringName of track.
$nodeID: StringURL of track that belongs to nodeID

Theme Config

ConfigDescription
primaryColor: ColorUsed for the controls
secondaryColor: ColorUsed for the controls alternative color
alertColor: ColorUsed for the controls alert colour eg unmute switch
nodeTitleBackground: ColorThe title background color
portraitNodeTitleBackground: ColorThe title background when in portrait
nodeTitleColor: ColorThe title text color
potraitNodeTitleColor: ColorThe title text color when in portrait
nodeBackground: ColorNode background...
nodeHeaderBackground: ColorNode header and footer background...
borderRadius: DimensionThe border radius (in pixels) that is used for the nodes, all buttons and panels,
loaderColor: ColorUsed to color the loading bar and any text under it
nodeBorder: ColorUsed to color the border of the nodes
edgeColor: ColorUsed to color the arrows that connect the nodes
progressColor: ColorUsed to color the sliders progress
backgroundColor: ColorSets the background color of the entire AudioFlow component.
height: DimensionThe height (pixels) of the audio graph viewport. (Default: 400)
showBackground: BoolControls whether to show the dotted background.
showDownloadConfigButton: BoolSets whether to show download configuration button. (Default: true)
showOpenInEditorButton: BoolSets whether to show the Open in editor button. (Default: true)
showSyncedTransportControls : BoolSets whether to show global transport controls. (Default: false)
showSyncedAudioSelector: BoolSets whether to show global track selector. (Default: false)
portraitBreakpoint: DimensionThe breakpoint (pixels) when the layout will switch to the simplified portrait view
showNodeNamespaces: BoolDisplays the node names spaces on the bottom of the nodes. (Default: true)