Skip to content

AudioMetadata

Metadata describing the format of audio data received from a provider.

Defined in: src/core/types/audio.ts:254

Metadata describing the format of audio data received from a provider.

Remarks

Audio metadata is emitted by TTS providers (via onMetadata) to inform the audio player how to decode and play the incoming audio chunks. This is especially important for WebSocket-based TTS providers where the audio format may not be known until the connection is established.

Example

// Listening for audio metadata from a TTS provider
ttsProvider.onMetadata((metadata) => {
  console.log(`Audio: ${metadata.sampleRate}Hz, ${metadata.encoding}, ${metadata.channels}ch`);
});

See

Properties

PropertyTypeDescriptionDefined in
bitDepth?numberBit depth of each audio sample. Remarks Common values are 16 (for linear16) and 24 (for high-fidelity audio). May be undefined for compressed formats like opus or mp3.src/core/types/audio.ts:275
channelsnumberNumber of audio channels (1 = mono, 2 = stereo).src/core/types/audio.ts:266
encodingAudioEncodingEncoding format of the audio samples. See AudioEncodingsrc/core/types/audio.ts:263
mimeType?stringMIME type of the audio data, if available. Remarks Examples: 'audio/pcm', 'audio/mpeg', 'audio/opus'. Useful for creating Blob objects from raw audio data.src/core/types/audio.ts:284
sampleRatenumberSample rate of the audio in Hz (e.g., 16000, 24000, 44100).src/core/types/audio.ts:256

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency