the-wav
v1.0.2
Published
Wav file writer
Downloads
6
Readme
the-wav
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.