Skip to content

AudioSource

Audio source that supplies PCM samples on demand.

PropertyModifierTypeDescription
channelCountreadonlynumberNumber of audio channels.
durationreadonlynumberTotal duration in seconds.
idreadonlystringStable identifier for caching computed STFT frames.
sampleRatereadonlynumberSample rate in Hz.
optional onRangeAvailable(handler: (range: AudioRange) => void): () => void;

Subscribes to progressive loading updates as new byte ranges arrive.

ParameterTypeDescription
handler(range: AudioRange) => voidCallback receiving the newly available time range in seconds.

Unsubscribe function.

() => void


read(options: object):
| Float32Array<ArrayBufferLike>
| Promise<Float32Array<ArrayBufferLike>>;

Reads PCM samples for a specific channel and time range.

ParameterTypeDescription
options{ channel: number; endTime: number; startTime: number; }Channel index and time span in seconds.
options.channelnumber-
options.endTimenumber-
options.startTimenumber-

| Float32Array<ArrayBufferLike> | Promise<Float32Array<ArrayBufferLike>>

Float32Array of normalized audio samples.