Class: SwitchboardSDK

SwitchboardSDK()

Main SwitchboardSDK class.

Constructor

new SwitchboardSDK()

Switchboard SDK constructor.
Source:

Methods

configure(sdkConfig) → {Promise}

Configures the Switchboard SDK. This method can be used inside a custom audio worklet processor to configure the Switchboard SDK.
Parameters:
Name Type Description
sdkConfig Object The SDK config object received in the worklet node.
Source:
Returns:
A promise for the configuration process.
Type
Promise

createAudioGraphProcessor(inputChannelLayout, outputChannelLayout, maxNumberOfFrames, sampleRate) → {AudioGraphProcessor}

Creates an AudioGraphProcessor to simplify running AudioGraph intances in custom worklet nodes.
Parameters:
Name Type Description
inputChannelLayout Array The input channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
outputChannelLayout Array The output channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
maxNumberOfFrames Number Max number of frames that the graph will be able to process.
sampleRate Number Sample rate.
Source:
Returns:
The created AudioGraphProcessor instance.
Type
AudioGraphProcessor

(async) createEngine(module, name, inputChannelLayout, outputChannelLayout) → {AudioEngine}

Creates an audio engine with a single custom AudioWorkletNode.
Parameters:
Name Type Description
module String The worklet node's module.
name String The worklet node's name.
inputChannelLayout Array The input channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
outputChannelLayout Array The output channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
Source:
Returns:
The created AudioEngine instance.
Type
AudioEngine

(async) createJSONGraphEngine(graphConfig, inputChannelLayout, outputChannelLayout) → {AudioEngine}

Creates an audio engine with a JSON audio graph config.
Parameters:
Name Type Description
graphConfig Object The JSON audio graph config.
inputChannelLayout Array The input channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
outputChannelLayout Array The output channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
Source:
Returns:
The created AudioEngine instance.
Type
AudioEngine

(async) createJSONGraphWorkletNode(graphConfig, audioContext, inputChannelLayout, outputChannelLayout) → {AudioWorkletNode}

Creates an AudioWorkletNode instance with a JSON audio graph config.
Parameters:
Name Type Description
graphConfig Object A JSON audio graph config.
audioContext AudioContext The WebAudio audio context.
inputChannelLayout Array The input channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
outputChannelLayout Array The output channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
Source:
Returns:
The created AudioWorkletNode instance.
Type
AudioWorkletNode

(async) createWorkletNode(audioContext, module, name, inputChannelLayout, outputChannelLayout) → {AudioWorkletNode}

Creates an AudioWorkletNode instance and sends the SDK configuration object to it.
Parameters:
Name Type Description
audioContext AudioContext The WebAudio audio context.
module String The worklet node's module.
name String The worklet node's name.
inputChannelLayout Array The input channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
outputChannelLayout Array The output channel layout for the audio graph. E.g. [2] means ones stereo bus, [2, 1] means a stereo and a mono audio buses.
Source:
Returns:
The created AudioWorkletNode instance.
Type
AudioWorkletNode

initialize(clientID, clientSecret, wasmPath, workletProcessorPath) → {Promise}

Initializes the Switchboard SDK.
Parameters:
Name Type Description
clientID String The client ID value that identifies the user of the SDK.
clientSecret String The client secret ID.
wasmPath String The path to the SwitchboardSDK.wasm file.
workletProcessorPath String The path to the SwitchboardSDKWorkletProcessor.js file.
Source:
Returns:
A promise for the initialization process.
Type
Promise

loadExtension(name, wasmPath) → {Promise}

Loads a Switchboard SDK extension.
Parameters:
Name Type Description
name String The name of the extension.
wasmPath String The path to the extension's WASM file.
Source:
Returns:
A promise for the loading process.
Type
Promise