audio-buffer
v5.0.0
Published
AudioBuffer class for node/browser
Downloads
858,404
Readme
audio-buffer
AudioBuffer - basic audio data container class. Useful instead of Buffer in audio streams, @audiojs components, in webworkers, nodejs, other environments without audio context.
Implementation is compatible with Web Audio API AudioBuffer, can be used as ponyfill.
Usage
new AudioBuffer(options)
Create audio buffer from options
.
options.length
— number of samples, minimum is 1.options.sampleRate
— default sample rate is 44100.options.numberOfChannels
— default number of channels is 1.
buffer.duration
Duration of the underlying audio data, in seconds.
buffer.length
Number of samples per channel.
buffer.sampleRate
Default sample rate is 44100.
buffer.numberOfChannels
Default number of channels is 1.
buffer.getChannelData(channel)
Get array containing the data for the channel (not copied).
buffer.copyFromChannel(destination, channelNumber, startInChannel=0)
Place data from channel to destination Float32Array.
buffer.copyToChannel(source, channelNumber, startInChannel=0)
Place data from source Float32Array to the channel.