AudioBuffer extension type

The AudioBuffer interface 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. Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode.

Objects of these types are designed to hold small audio snippets, typically less than 45 s. For longer sounds, objects implementing the MediaElementAudioSourceNode are more suitable. The buffer contains the audio signal waveform encoded as a series of amplitudes in the following format: non-interleaved IEEE754 32-bit linear PCM with a nominal range between -1 and +1, that is, a 32-bit floating point buffer, with each sample between -1.0 and 1.0. If the AudioBuffer has multiple channels, they are stored in separate buffers.


API documentation sourced from MDN Web Docs.

on
Implemented types
Available extensions

Constructors

AudioBuffer(AudioBufferOptions options)
factory

Properties

duration double
The duration property of the AudioBuffer interface returns a double representing the duration, in seconds, of the PCM data stored in the buffer.
no setter
hashCode int
The hash code for this object.
no setterinherited
length int
The length property of the AudioBuffer interface returns an integer representing the length, in sample-frames, of the PCM data stored in the buffer.
no setter
numberOfChannels int
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.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampleRate double
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.
no setter

Methods

copyFromChannel(JSFloat32Array destination, int channelNumber, [int bufferOffset]) → void
The copyFromChannel() method of the AudioBuffer interface copies the audio sample data from the specified channel of the AudioBuffer to a specified Float32Array.
copyToChannel(JSFloat32Array source, int channelNumber, [int bufferOffset]) → void
The copyToChannel() method of the AudioBuffer interface copies the samples to the specified channel of the AudioBuffer, from the source array.
getChannelData(int channel) JSFloat32Array
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).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited