the-wav

1.0.2 • Public • Published

the-wav

Build Status npm Version JS Standard

Wav file writer

Installation

$ npm install the-wav --save

Usage

'use strict'
 
const { TheWAV } = require('the-wav')
 
async function tryExample () {
  const wav = new TheWAV(`sample01.wav`, {
    sampleRate: 48000,
  })
 
  const seconds = 10
  // Create white noise 10 sec
  const whiteNoise10sec = [
    new Float32Array(wav.sampleRate * seconds).map(() => Math.random() - 0.5),
    new Float32Array(wav.sampleRate * seconds).map(() => Math.random() - 0.5),
  ]
 
  // Append data
  await wav.append(whiteNoise10sec)
  await wav.append(whiteNoise10sec)
 
  // Write into file
  await wav.flush()
}
 
tryExample().catch((err) => console.error(err))
 

API Guide

License

This software is released under the MIT License.

Links

Readme

Keywords

Package Sidebar

Install

npm i the-wav

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

59.3 kB

Total Files

33

Last publish

Collaborators

  • okunishinishi