Encodes the contents of an AudioBuffer from the WebAudio API as WAVE. Supports 16-bit PCM and 32-bit float data.
The code for this has been adapted from the export feature of Recorder.js.
npm install audiobuffer-to-wav --save
var toWav =var xhr =var context =// request the MP3 as binary
See the demo for an example of loading MP3, decoding it, and triggering a download of the encoded WAV file.
A more advanced example might be to write the file using Node and Electron or hihat, i.e. an easy way to convert MP3/OGG/etc to WAV.
Encodes the AudioBuffer instance as WAV, returning a new array buffer. Interleaves multi-channel data, if necessary.
By default, exports with 16-bit PCM (format: 1). You can specify
opt.float32 instead, which will write format 3 with 32-bit float data.
MIT, see LICENSE.md for details.