Thursday, 29 November 2018

How to setup codec, samplerate and bitrate on an audio blob in javascript?

I just created a blob:

const audioBlob = new Blob(audioChunks, { 'type' : 'audio/wav; codecs=0' });

and sent it to the backend in base64 format. I saved this into a file named "test.wav" using the following code:

await writeFile('./temp/test.wav', Buffer.from(filename.replace('data:audio/wav; codecs=0;base64,', ''), 'base64'), 'base64');

On the output "test.wav" file, I get the codec as opus, bitrate=N/A and sample rate=48000. I want to change these values to codec=wav, bitrate=256kbps and sample rate=16000. How to achieve it in node(or angular)?

Here is a link for my frontend code.



from How to setup codec, samplerate and bitrate on an audio blob in javascript?

No comments:

Post a Comment