New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

audio-buffer

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audio-buffer - npm Package Compare versions

Comparing version 2.4.5 to 2.4.6

2

package.json
{
"name": "audio-buffer",
"version": "2.4.5",
"version": "2.4.6",
"description": "Audio data container",

@@ -5,0 +5,0 @@ "main": "index.js",

# audio-buffer [![Build Status](https://travis-ci.org/audiojs/audio-buffer.svg?branch=master)](https://travis-ci.org/audiojs/audio-buffer) [![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)
[AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) optimal implementation for node. In browser provides just a useful constructor for web-audio’s _AudioBuffer_, in node is also useful instead of _Buffer_ in audio streams.
[AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) ponyfill. Provides useful constructor for Web-Audio API _AudioBuffer_, if available, otherwise provides optimal _AudioBuffer_ implementation for node/browsers. Useful instead of _Buffer_ in audio streams (see [**@audiojs**](https://github.com/audiojs) components).
[![build status](https://img.shields.io/travis/audiojs/audio-buffer.svg)](https://travis-ci.org/audiojs/audio-buffer)
![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)
## Usage

@@ -13,3 +10,3 @@

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

@@ -19,24 +16,24 @@ //Create audio buffer from a data source or of a length.

//It can be Array, TypedArray, ArrayBuffer, Buffer, AudioBuffer, DataView, NDArray etc.
var buffer = new AudioBuffer(channels?, data|length, sampleRate?);
var buffer = new AudioBuffer(channels = 2, data|length, sampleRate = 44100)
//Duration of the underlying audio data, in seconds
buffer.duration;
buffer.duration
//Number of samples per channel
buffer.length;
buffer.length
//Default sample rate is 44100
buffer.sampleRate;
buffer.sampleRate
//Default number of channels is 2
buffer.numberOfChannels;
buffer.numberOfChannels
//Get array containing the data for the channel (not copied)
buffer.getChannelData(channel);
buffer.getChannelData(channel)
//Place data from channel to destination Float32Array
buffer.copyFromChannel(destination, channelNumber, startInChannel?);
buffer.copyFromChannel(destination, channelNumber, startInChannel = 0)
//Place data from source Float32Array to the channel
buffer.copyToChannel(source, channelNumber, startInChannel?);
buffer.copyToChannel(source, channelNumber, startInChannel = 0)

@@ -46,18 +43,21 @@

//Type of array for data. Float64 is faster for last node/browsers.
AudioBuffer.FloatArray = Float64Array;
//Type of array for data. Float64Array is faster for modern node/browsers.
AudioBuffer.FloatArray = Float64Array
//In browser, you can set the audio context (online/offline).
//By default it is taken from audio-context module.
AudioBuffer.context;
//In browser, you can set custom audio context (online/offline).
AudioBuffer.context = require('audio-context')
//Whether WebAudioAPI Buffer should be created, if possible, instead of own instance
//In browser it is true, if WAA is available.
AudioBuffer.isWAA;
//Whether WebAudioAPI AudioBuffer should be created, if avail, instead of polyfilled structure
AudioBuffer.isWAA = true
```
## Related
## See also
* [audio-buffer-utils](https://github.com/audiojs/audio-buffer-utils) — utils for audio buffers
* [pcm-util](https://npmjs.org/package/pcm-util) — utils for audio format convertions.
## Similar
* [ndsamples](https://github.com/livejs/ndsamples) — audio-wrapper for ndarrays. A somewhat alternative approach to wrap audio data, based on ndarrays, used by some modules in [livejs](https://github.com/livejs).
* [1](https://www.npmjs.com/package/audiobuffer), [2](https://www.npmjs.com/package/audio-buffer), [3](https://github.com/sebpiq/node-web-audio-api/blob/master/lib/AudioBuffer.js), [4](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) — other AudioBuffer implementations.
* [audiodata](https://www.npmjs.com/package/audiodata) alternative data holder from @mohayonao.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc