wav-headers

Generates wav header buffer to concatenated with the wav body buffer

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
wav-headers
1.0.16 years ago6 years agoMinified + gzip package size for wav-headers in KB

Readme

wav-headers
Generates wav header buffer to concatenated with the wav body buffer
This is mostly a wrapper around: https://github.com/TooTallNate/node-wav just without streams and designed for full file cases.

Installation

Install through npm:
$ npm install wav-headers

Example

var fs = require('fs');
var getFileHeaders = require('wav-headers');

// those are defaults
var options = {
	channels: 2,
	sampleRate: 44100,
	bitDepth: 16,
	dataLength: 4294967295
};

var headersBuffer = getFileHeaders(options);
var fullBuffer = Buffer.concat([ headersBuffer, fileBodyBuffer ]);

var stream = fs.createWriteStream('./aFile.wav');
stream.write(fullBuffer, function() {
	stream.end();
});