Should a WAV audio file be twice size as an Audio Buffer?

I have a JS webaudio AudioBuffer which I convert to WAV using 3rd party code, and the length / size of WAV is always at least twice the size of the AudioBuffer. As I am handling long duration audio (multi MB) its a potential issue.

My AudioBuffer is single channel (mono) and I have confirmed I am creating a mono WAV (where the library creates a stereo WAV, file size is 4x). I have tried using several solutions for the conversion but cannot get a WAV file of same size as AudioBuffer. I tried Crunker, audiobuffer-to-wav, this post. With audiobuffer-to-wav I tried both 16 bit (2x) and 32 bit (4x).

Maybe it is not possible and due to audio data formats. But ideally I could get a WAV the same file size as AudioBuffer or even better a compressed MP3.

As context, I am feeding the WAV into an HTML audio element. I realise I can play audio direct with Web Audio, but have reasons to use an HTML audio element. Thanks for any help!



Read more here: https://stackoverflow.com/questions/65706177/should-a-wav-audio-file-be-twice-size-as-an-audio-buffer

Content Attribution

This content was originally published by Gavin at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: