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
Config | Description |
---|---|
title : String | Title of the audio graph. |
nodes : Array | List of audio node configs. |
connections : Array | List of connection configs. Optional. If this setting is not present, all nodes are connected sequentially. |
presets : Array | List of preset configs. |
theme : Object | Theme config. |
tracks : Array | List of track list configs. These tracks will be loaded into the player nodes. |
Node Types
Config | Description |
---|---|
id : String | ID 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 : String | Type for audio node. Can be: UserInputSource : WebAudio input source node OutputNode : WebAudio output node |
uiConfig : Object | Config object for the node that controls how the node is displayed in the UI. (Optional) |
WebAudio Node Types
Config | Description |
---|---|
id : String | ID 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 : String | Type for audio node. Can be: WebAudio.AudioPlayer : WebAudio Buffer Source NodeWebAudio.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 : Object | Config object for the node that controls how the node is displayed in the UI. (Optional) |
Switchboard Node Types
Config | Description |
---|---|
id : String | ID 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 : String | Type 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 : Object | Config object for the node that controls how the node is displayed in the UI. (Optional) |
Superpowered Node Types
Config | Description |
---|---|
id : String | ID 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 : String | Type for audio node. Can be: Superpowered.AdvancedAudioPlayer : Superpowered AdvancedAudioPlayerSuperpowered.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 : Object | Config object for the node that controls how the node is displayed in the UI. (Optional) |
RNNoise Node Types
Config | Description |
---|---|
id : String | ID 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 : String | Type for audio node. Can be: RNNoise.NoiseFilter : RNNoise Nosie Filter |
uiConfig : Object | Config object for the node that controls how the node is displayed in the UI. (Optional) |
Connection Config
Config | Description |
---|---|
sourceNode : String | Source node ID. |
sourceBusIndex : Int | Source node bus index. Optional. Default: 0 |
destinationNode : String | Destination node ID. "outputNode" can be used for the implicitly created output node. |
destinationBusIndex : Int | Destination node bus index. Optional. Default: 0 |
Node UI Config
Config | Description |
---|---|
title : String | Title of the audio node. |
tracks : Array | List of track config objects. |
position : Object | Optional position config object for the audio node. |
showHandleIndexes : Boolean | Shows bus number labels. Default false |
Track Config
Config | Description |
---|---|
label : String | Label for sample. |
url : String | URL of sample. |
Position Config
If no positon config object is supplied, the audio graph will auto layout.
Config | Description |
---|---|
x : Number | X coordinate. |
y : Number | Y coordinate. |
Preset Config
Config | Description |
---|---|
name : String | Name of preset. |
nodes : Object | List of parameter config arrays keyed by node ID. |
Track List Config
Config | Description |
---|---|
label : String | Name of track. |
$nodeID : String | URL of track that belongs to nodeID |
Theme Config
Config | Description |
---|---|
primaryColor : Color | Used for the controls |
secondaryColor : Color | Used for the controls alternative color |
alertColor : Color | Used for the controls alert colour eg unmute switch |
nodeTitleBackground : Color | The title background color |
portraitNodeTitleBackground : Color | The title background when in portrait |
nodeTitleColor : Color | The title text color |
potraitNodeTitleColor : Color | The title text color when in portrait |
nodeBackground : Color | Node background... |
nodeHeaderBackground : Color | Node header and footer background... |
borderRadius : Dimension | The border radius (in pixels) that is used for the nodes, all buttons and panels, |
loaderColor : Color | Used to color the loading bar and any text under it |
nodeBorder : Color | Used to color the border of the nodes |
edgeColor : Color | Used to color the arrows that connect the nodes |
progressColor : Color | Used to color the sliders progress |
backgroundColor : Color | Sets the background color of the entire AudioFlow component. |
height : Dimension | The height (pixels) of the audio graph viewport. (Default: 400) |
showBackground : Bool | Controls whether to show the dotted background. |
showDownloadConfigButton : Bool | Sets whether to show download configuration button. (Default: true) |
showOpenInEditorButton : Bool | Sets whether to show the Open in editor button. (Default: true) |
showSyncedTransportControls : Bool | Sets whether to show global transport controls. (Default: false) |
showSyncedAudioSelector : Bool | Sets whether to show global track selector. (Default: false) |
portraitBreakpoint : Dimension | The breakpoint (pixels) when the layout will switch to the simplified portrait view |
showNodeNamespaces : Bool | Displays the node names spaces on the bottom of the nodes. (Default: true) |