Closed cdauth closed 4 months ago
WAV files can be as simple as a header prefixing PCM audio data in a certain format (bit width + signedness). Generating WAV files from raw PCM samples is relatively easy: see the tiny wav-encoder source.
I think you want to slightly modify the wav-encoder source to work incrementally in chunks, maybe even implementing a Streams interface for maximum interop. WASM won't help here as there is almost nothing to compute and all the time would be spent copying data back and forth between JS and the WASM memory.
Thank you for this amazing library.
In my app, I'm providing MP3 and WAV export. The purpose of the WAV export is that if users need the audio in a format that my app doesn't provide, the WAV export makes more sense than the MP3 export, because it is lossless and much faster to generate, so it is better to integrate into a workflow where the exported audio is converted into another format using an external tool.
Right now I'm using wav-encoder to generate the WAV. It has two drawbacks:
This is why I would like to see WAV support in this library. Unfortunately I have no expertise with WASM, so I'm not able to contribute an implementation.