Recorderjs
Recorderjs copied to clipboard
Allow WAV export of complete AudioBuffer
Was thinking of writing this and submitting a PR, but I wanted to see if anyone else thought it might be useful first.
Here's one use case that comes to mind:
I've created an OfflineAudioContext, rendered my mix (or whatever it is), and now I have a full AudioBuffer that I just want to export to WAV, so there's no need to attach a ScriptProcessorNode and "record" it in chunks. Obviously I can sort of do this myself by creating my own Web Worker and just passing it a sampleRate and two Float32Arrays - but it might be nice to have a static method on Recorder that will do it for me.
What do you think? Should I write it?
Oh, and thanks so much for writing this library. It served as a fantastic learning resource when I needed to do WAV export in my own app.
Hey, sorry for not replying to this... feel free to submit a PR. And you're welcome, glad to hear the library helped you out.
@kevincennis Write it! Write it! :)
I need to do this too, but my coding skills aren't up to it. I've used OfflineAudioContext to create the mix buffer, but I want it to be converted to a WAV file people can download.
Was hoping Recorder.js could perform this "faster-than-realtime" export to WAV using OfflineAudioContext.
Is there any library that exists now that can take an audio buffer and export it to a WAV file for download?
Hey @sotoole,
Still gotta spend a little time figuring out the cleanest way to integrate this. Don't want to muddy up the Recorder constructor, but I also don't want to end up with a static method that duplicates a bunch of code.
In the meantime, here's a gist that should do more or less what you want (or at least get you pointed in the right direction): https://gist.github.com/kevincennis/5989134
Disclaimer: I wrote this in about 3 minutes and didn't test it.
@kevincennis Took a quick look and it looks like exactly what I need. Thanks so much! I'll test it out tomorrow.
@kevincennis Works perfectly. Thanks again to you and @mattdiamond
Hey @mattdiamond,
Two years later, I found this in my list of open issues and realized I never did submit a PR. Gonna try to knock this out over the weekend.
Any preference for what this gets called? I was thinking just a static method like:
Recorder.toWAV( audioBuffer, function( blob ) {
// do what you will
});