For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Interface AudioData
duration: number;
format: AudioSampleFormat | null;
numberOfChannels: number;
numberOfFrames: number;
sampleRate: number;
timestamp: number;
allocationSize(options: AudioDataCopyToOptions): number;
clone(): AudioData;
close(): void;
copyTo(
destination: AllowSharedBufferSource,
options: AudioDataCopyToOptions,
): void;
}
Properties
Readonlyduration
The duration read-only property of the AudioData interface returns the duration in microseconds of this AudioData object.
Readonlyformat
The format read-only property of the AudioData interface returns the sample format of the AudioData object.
ReadonlynumberOfChannels
The numberOfChannels read-only property of the AudioData interface returns the number of channels in the AudioData object.
ReadonlynumberOfFrames
The numberOfFrames read-only property of the AudioData interface returns the number of frames in the AudioData object.
ReadonlysampleRate
The sampleRate read-only property of the AudioData interface returns the sample rate in Hz.
Readonlytimestamp
The timestamp read-only property of the AudioData interface returns the timestamp of this AudioData object.
Methods
allocationSize
-
The
allocationSize()method of the AudioData interface returns the size in bytes required to hold the current sample as filtered by options passed into the method.Parameters
- options: AudioDataCopyToOptions
Returns number
clone
-
The
clone()method of the AudioData interface creates a new AudioData object with reference to the same media resource as the original.Returns AudioData
close
-
The
close()method of the AudioData interface clears all states and releases the reference to the media resource.Returns void
copyTo
-
The
copyTo()method of the AudioData interface copies a plane of an AudioData object to a destination buffer.Parameters
- destination: AllowSharedBufferSource
- options: AudioDataCopyToOptions
Returns void
The
AudioDatainterface of the WebCodecs API represents an audio sample.MDN Reference