Skip to content

blobToArrayBuffer

Converts an audio Blob to an ArrayBuffer.

function blobToArrayBuffer(blob): Promise<ArrayBuffer>;

Defined in: src/utils/audio.ts:320

Converts an audio Blob to an ArrayBuffer.

Parameters

ParameterTypeDescription
blobBlobThe audio Blob to convert.

Returns

Promise<ArrayBuffer>

A promise that resolves to the ArrayBuffer representation of the blob.

Remarks

Uses the FileReader API for broad browser compatibility. This is useful when working with audio Blob objects returned from REST TTS providers that need to be processed as raw bytes.

Throws

Error if the FileReader encounters an error during reading.

Example

const audioBlob = await tts.synthesize('Hello');
const buffer = await blobToArrayBuffer(audioBlob);
// Process raw audio bytes

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency