Skip to content
1 min read · 127 words

Variable: defaultDecodeAudio ​

ts
const defaultDecodeAudio: DecodeAudioFn;

Defined in: src/batteries/specialists/_shared/index.ts:165

Default DecodeAudioFn: lazily imports the optional audio-decode peer, decodes the container, then downmixes to mono via downmixToMono.

Remarks ​

audio-decode resolves to one of two shapes depending on codec/environment: an AudioBuffer-compatible object (numberOfChannels + getChannelData()) or a plain { channelData: Float32Array[], sampleRate } record (e.g. the wav path in Node). Both are normalized identically to how src/batteries/media/engines/audio_decode.ts handles them, lifted into this standalone function rather than shared code (that engine's own copy stays untouched — it belongs to the media battery, not to specialists).

Param ​

bytes

The encoded audio container bytes.

Returns ​

The decoded mono PCM samples and the source sample rate, in Hz.

Throws ​

An Error naming the install command when the audio-decode peer is not installed.