You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to encode the webm audio result from MediaRecorder API in Chrome into mp3.
But all I got is a short noisy audio.
Without encoding, the given webm audio is good. I can write it to file or play in a audio element.
this.mediaRecorder.ondataavailable = e => {
this.chunks.push(e.data);
};
let fileReader = new FileReader();
fileReader.onload = () => {
let mp3Data = [];
let samples = new Int16Array(fileReader.result as ArrayBuffer);
let mp3encoder = new lamejs.Mp3Encoder(1, 48000, 128);
let mp3Buffer = mp3encoder.encodeBuffer(samples);
if (mp3Buffer.length > 0) mp3Data.push(mp3Buffer);
mp3Buffer = mp3encoder.flush();
if (mp3Buffer.length > 0) mp3Data.push(mp3Buffer);
// mp3Data should be ready here ?
};
fileReader.readAsArrayBuffer(new Blob(this.chunks, { type: "audio/webm" }));
Could you help me figuring out where I am wrong ?
Thanks !
The text was updated successfully, but these errors were encountered:
Hi,
I'm trying to encode the webm audio result from MediaRecorder API in Chrome into mp3.
But all I got is a short noisy audio.
Without encoding, the given webm audio is good. I can write it to file or play in a audio element.
Could you help me figuring out where I am wrong ?
Thanks !
The text was updated successfully, but these errors were encountered: