Class: AudioEngine

AudioEngine()

AudioEngine class. Creates an WebAudio audio context and manages a Switchboard AudioWorkletNode.

Constructor

new AudioEngine()

AudioEngine constructor.
Source:

Methods

getAudioContext() → {AudioContext}

Gets the WebAudio audio context.
Source:
Returns:
The WebAudio audio context.
Type
AudioContext

getAudioWorkletNode() → {AudioWorkletNode}

Gets the AudioWorkletNode instance.
Source:
Returns:
The AudioWorkletNode instance.
Type
AudioWorkletNode

(async) getUserAudioStream(constraints)

Gets the user audio stream
Parameters:
Name Type Description
constraints Object Constraints for the user media.
Source:
Returns:
The user media.

initialize(workletNode)

Initializes the audio engine with a worklet node.
Parameters:
Name Type Description
workletNode AudioWorkletNode The audio worklet node that does the audio processing.
Source:

loadAudio(url) → {Promise}

Loads and decodes audio from a URL.
Parameters:
Name Type Description
url String The URL of the audio to load.
Source:
Returns:
A promise for the loading and decoding process that provides an audio buffer.
Type
Promise

postMessage(message)

Posts a message to the worklet node's port.
Parameters:
Name Type Description
message Object The message to send to the worklet node.
Source:

start()

Starts the audio engine. Resumes the audio context.
Source:

stop()

Stops the audio engine. Suspends the audio context.
Source: