Interface AudioBuffer
duration: number;
length: number;
numberOfChannels: number;
sampleRate: number;
copyFromChannel(
destination: Float32Array<ArrayBuffer>,
channelNumber: number,
bufferOffset?: number,
): void;
copyToChannel(
source: Float32Array<ArrayBuffer>,
channelNumber: number,
bufferOffset?: number,
): void;
getChannelData(channel: number): Float32Array<ArrayBuffer>;
}
Index
Properties
Methods
Properties
Readonlyduration
The duration property of the AudioBuffer interface returns a double representing the duration, in seconds, of the PCM data stored in the buffer.
Readonlylength
The length property of the AudioBuffer interface returns an integer representing the length, in sample-frames, of the PCM data stored in the buffer.
ReadonlynumberOfChannels
The numberOfChannels property of the AudioBuffer interface returns an integer representing the number of discrete audio channels described by the PCM data stored in the buffer.
ReadonlysampleRate
The sampleRate property of the AudioBuffer interface returns a float representing the sample rate, in samples per second, of the PCM data stored in the buffer.
Methods
copyFromChannel
- copyFromChannel(
destination: Float32Array<ArrayBuffer>,
channelNumber: number,
bufferOffset?: number,
): voidThe
copyFromChannel()method of the channel of theAudioBufferto a specifiedjs-nolint copyFromChannel(destination, channelNumber, startInChannel)-destination- : A Float32Array to copy the channel's samples to.Parameters
- destination: Float32Array<ArrayBuffer>
- channelNumber: number
OptionalbufferOffset: number
Returns void
copyToChannel
- copyToChannel(
source: Float32Array<ArrayBuffer>,
channelNumber: number,
bufferOffset?: number,
): voidThe
copyToChannel()method of the AudioBuffer interface copies the samples to the specified channel of theAudioBuffer, from the source array.Parameters
- source: Float32Array<ArrayBuffer>
- channelNumber: number
OptionalbufferOffset: number
Returns void
getChannelData
The
getChannelData()method of the AudioBuffer Interface returns a Float32Array containing the PCM data associated with the channel, defined by the channel parameter (with 0 representing the first channel).Parameters
- channel: number
Returns Float32Array<ArrayBuffer>
The
AudioBufferinterface represents a short audio asset residing in memory, created from an audio file using the BaseAudioContext/decodeAudioData method, or from raw data using BaseAudioContext/createBuffer.MDN Reference