I'm gathering audio from the browser using MediaRecorder and the audio file being produced has a codec that is incompatible with IBM Watson Speech to Text. The codec is "matroska" and I need it to be raw PCM codec.
How do I set the codec of an audio file that I'm gathering from the browser? Here's some of the code that I'm using:
var options = {
audioBitsPerSecond : 32000
}
var mediaRecorder = new MediaRecorder(audioStream, options);
mediaRecorder.start();
var data = [];
mediaRecorder.ondataavailable = e => console.log(mediaRecorder.audioBitsPerSecond);
mediaRecorder.ondataavailable = e => e.data.size && data.push(e.data);
mediaRecorder.onstop = () => process(data);
function process(data) {
var int16Array = [];
const blob = new Blob(data, {
type: 'audio/wav'
})