New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

wav-encoder

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wav-encoder

promise-based wav encoder

latest
Source
npmnpm
Version
1.3.0
Version published
Maintainers
1
Created
Source

wav-encoder

Build Status NPM Version License

promise-based wav encoder

Installation

$ npm install wav-encoder

API

  • encode(audioData: AudioData, [opts: object]): Promise<ArrayBuffer>
    • audioData should contain two fields sampleRate and channelData.
    • opts is an optional parameter which used to design the output wav format.
      • opts.bitDepth the number of bits of information in each sample
      • opts.float encode to float values
      • opts.symmetric encode to symmetrical values (see #10)
      • The default format is { float: false, bitDepth: 16 }
  • encode.sync(audioData: AudioData, [opts: object]): ArrayBuffer
    • synchronous version
interface AudioData {
  sampleRate: number;
  channelData: Float32Array[];
}

Usage

const fs = require("fs");
const WavEncoder = require("wav-encoder");

const whiteNoise1sec = {
  sampleRate: 44100,
  channelData: [
    new Float32Array(44100).map(() => Math.random() - 0.5),
    new Float32Array(44100).map(() => Math.random() - 0.5)
  ]
};

WavEncoder.encode(whiteNoise1sec).then((buffer) => {
  fs.writeFileSync("noise.wav", new Buffer(buffer));
});

License

MIT

Keywords

encode

FAQs

Package last updated on 11 Aug 2017

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