Skip to content
Abstract class

AudioSampleResource

Abstract base class for custom audio sample resources. Implement this class to provide custom backing for AudioSample instances.

Subclasses

Used by

Methods

close()

ts
close(): void;

Closes this resource, releasing held resources. Called automatically when the last AudioSample using this resource is closed.

getDataPlane()

ts
getDataPlane(
	planeIndex: number,
): Uint8Array<ArrayBufferLike>;

Returns the audio sample data for the plane given by planeIndex. The audio data must be in the format returned by getFormat(). For interleaved formats, there is only one plane.

getFormat()

ts
getFormat(): AudioSampleFormat;

Returns the audio sample format. See sample formats

getNumberOfChannels()

ts
getNumberOfChannels(): number;

Returns the number of audio channels.

getNumberOfFrames()

ts
getNumberOfFrames(): number;

Returns the number of audio frames in the sample, per channel.

getSampleRate()

ts
getSampleRate(): number;

Returns the audio sample rate in hertz.

getTimestamp()

ts
getTimestamp(): number;

Returns the presentation timestamp of the sample in seconds.

Released under the Mozilla Public License 2.0.