Skip to content
1 min read · 154 words

Interface: AudioBufferLike

Defined in: src/batteries/media/engines/audio_decode.ts:33

The decoded shapes audio-decode resolves to. Some codecs return an AudioBuffer-compatible object (numberOfChannels + getChannelData); others (e.g. the wav path in Node) return a plain { channelData: Float32Array[], sampleRate } record. The engine normalizes both.

Properties

PropertyTypeDescriptionDefined in
channelData?Float32Array<ArrayBufferLike>[]Raw per-channel sample arrays on the plain-record shape.src/batteries/media/engines/audio_decode.ts:41
numberOfChannels?numberChannel count when the AudioBuffer-compatible shape is returned.src/batteries/media/engines/audio_decode.ts:35
sampleRatenumberSample rate of the decoded audio, in Hz. Present on both shapes.src/batteries/media/engines/audio_decode.ts:37

Methods

getChannelData()?

ts
optional getChannelData(channel: number): Float32Array;

Defined in: src/batteries/media/engines/audio_decode.ts:39

Per-channel sample accessor on the AudioBuffer-compatible shape.

Parameters

ParameterType
channelnumber

Returns

Float32Array