JSPM

  • Created
  • Published
  • Downloads 113524
  • Score
    100M100P100Q153172F
  • License MIT

Data container for audio processing purposes

Package Exports

  • audio-buffer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (audio-buffer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Audio buffer interface for any audio data: AudioBuffer, Buffer, TypedArray, Array, NDarray or any Object with get/set methods. Fully compatible with ndarrays, so any ndarray modules can be used over audio buffers. It is designed to provide wrapper audio methods for the underlying data storage, so the data is kept untouched.

Usage

npm install audio-buffer

var AudioBuffer = require('audio-buffer');

//create audio buffer from any type of array
var buffer = new AudioBuffer([0,0,1,1], {channels: 2});

API

//create audio buffer from any type of data source. Pass format as a second argument.
var buffer = new AudioBuffer(data, format);

//NDarray with the data
buffer.data;

//Raw data object - array, buffer, etc.
buffer.rawData;

//Duration of the underlying audio data, in seconds
buffer.duration;

//Number of samples per channel
buffer.length;
buffer.samplesPerFrame;

//Sample rate
buffer.sampleRate;

//Number of channels
buffer.channels;
buffer.numberOfChannels;

//Get sample value
buffer.get(channel, index);

//Set sample value
buffer.set(channel, index, value);

//Get array containing the data for the channel
buffer.getChannelData(channel);

Audio methods

Array methods

Ndarray methods

ndsamples — audio-wrapper for ndarrays.
ndarray — generic multidimensional arrays.