The AudioBuffer
interface represents a short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData()
method, or from raw data using AudioContext.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.