AudioClip

Object containing all data needed to record and render an audio clip.

Methods

async finalize()

Stops recording any future audio data within the AudioClip, finalizes the internal storage of all recorded data, and calls the user-completion notification callback, if registered.

Note that this function is called automatically if the original call to recordAudioClip() specified a concrete duration for the clip. If no duration was specified, then this function must be called in order to stop recording. An AudioClip is unable to be used or played back until this function has been called.

getDuration() → {number}

Returns the total duration of the audio clip in seconds.

Returns:
number -

Duration of the audio clip in seconds

async getEncodedData(encodingType) → {Blob}

Encodes this AudioClip into a Blob containing raw audio data according to the EncodingType specified in the encodingType parameter.

Parameters:
Name Type Description
encodingType number

Numeric value corresponding to the desired EncodingType

Returns:
Blob -

Data Blob containing the newly encoded audio data

See:

getRawData() → {Blob}

Returns a Blob containing all of the recorded audio data.

Returns:
Blob -

Buffer containing all recorded audio data

notifyWhenComplete(notificationCallback)

Allows a user to register a callback for notification when all audio recording activities have been completed for this AudioClip. This corresponds to the time when the finalize() function gets called, either manually or automatically.

A user-defined notification callback will be called with a single parameter which is a reference to this AudioClip.

Parameters:
Name Type Description
notificationCallback RecordCompleteCallback

Callback to fire when recording of this clip has completed