Skip to content
1 min read · 120 words

Interface: RawAudioLike

Defined in: src/batteries/tts/_shared/index.ts:89

The minimal structural slice of transformers.js's RawAudio the TTS engine consumes: a single toBlob() that encodes the synthesized samples to a WAV Blob.

Remarks

transformers.js RawAudio.toBlob() calls its internal encodeWAV() — a pure ArrayBuffer/DataView/Blob path with type: 'audio/wav' — so it works in Node (Node ≥18 has a global Blob) as well as the browser; it is NOT the browser-only path that RawImage.toBlob() guards. toBlob() is the ONLY method the engine needs (it never reads raw audio/sampling_rate), so this contract carries toBlob alone — the fake pipeline in unit tests implements exactly this.

Methods

toBlob()

ts
toBlob(): Blob;

Defined in: src/batteries/tts/_shared/index.ts:91

Encode the synthesized audio to a WAV Blob (type: 'audio/wav').

Returns

Blob