Socket
Book a DemoInstallSign in
Socket

audio-buffer

Package Overview
Dependencies
Maintainers
5
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audio-buffer

AudioBuffer class for node/browser

5.0.0
latest
Source
npmnpm
Version published
Weekly downloads
102K
-11.73%
Maintainers
5
Weekly downloads
 
Created
Source

audio-buffer test stable

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

npm install audio-buffer

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.

Similar

  • ndsamples — audio-wrapper for ndarrays. A somewhat alternative approach to wrap audio data, based on ndarrays, used by some modules in livejs.
  • 1, 2, 3, 4 — other AudioBuffer implementations.
  • audiodata alternative data holder from @mohayonao.

🕉

Keywords

audio

FAQs

Package last updated on 28 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.