Skip to content

DecodedAudioSource

Audio source that supplies PCM samples on demand.

new DecodedAudioSource(buffer: AudioBuffer, id?: string): DecodedAudioSource;
ParameterType
bufferAudioBuffer
idstring

DecodedAudioSource

PropertyModifierTypeDescription
channelCountreadonlynumberNumber of audio channels.
durationreadonlynumberTotal duration in seconds.
idreadonlystringStable identifier for caching computed STFT frames.
sampleRatereadonlynumberSample rate in Hz.
read(options: object): Float32Array;

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

Float32Array of normalized audio samples.

AudioSource.read


static fromBlob(
blob: Blob,
options?:
| AudioContextLike
| {
audioContext?: AudioContextLike;
sampleRate?: number;
},
id?: string): Promise<DecodedAudioSource>;
ParameterType
blobBlob
options?| AudioContextLike | { audioContext?: AudioContextLike; sampleRate?: number; }
id?string

Promise<DecodedAudioSource>


static fromBuffer(
buffer: ArrayBuffer | Uint8Array<ArrayBufferLike>,
options?:
| AudioContextLike
| {
audioContext?: AudioContextLike;
sampleRate?: number;
},
id?: string): Promise<DecodedAudioSource>;
ParameterType
bufferArrayBuffer | Uint8Array<ArrayBufferLike>
options?| AudioContextLike | { audioContext?: AudioContextLike; sampleRate?: number; }
id?string

Promise<DecodedAudioSource>


static fromUrl(url: string, options?:
| AudioContextLike
| {
audioContext?: AudioContextLike;
sampleRate?: number;
}): Promise<DecodedAudioSource>;
ParameterType
urlstring
options?| AudioContextLike | { audioContext?: AudioContextLike; sampleRate?: number; }

Promise<DecodedAudioSource>