There is such code:
let source = audioCtx.createBufferSource();
source.buffer = myArrayBuffer;
source.connect(audioCtx.destination);
source.start();
Which successfully plays on the page. Need this audio download from the page, but have no idea how it converti in the Blob. Tried to convert to wave, but somewhere is a mistake made, not envelope.
Are there easier ways to download audio?
If convert to wav, then here is a good piece of code:
https://github.com/Jam3/audiobuffer-to-wav/blob/ma...
But then how to convert this wav to a Blob?
I tried this:
// Wav -> blob
function getBlobFromWav(wav) {
let srclist = [];
let count = wav.byteLength;
for (let i = 0; i < count; i++) {
srclist.push(wav[i]);
}
return new Blob(srclist, { type: 'audio/wav' });
}
But I have page krasitsja even at 4-second file.