0

I use https://github.com/mattdiamond/Recorderjs library to capture the audio.

recorder.exportWAV((data)->
        fileReader = new FileReader;
        fileReader.onload = (blob) ->
            blob = blob.target.result;
            send(btoa(blob))
        fileReader.readAsBinaryString(data)
      )

But I got the following error: Must use single channel (mono) audio, but WAV header indicates 2 channels.

When I use exportMonoWAV the quality of audio is very low and recognition results are poor.

How can I pass Mono WAV without losing the quality?

Paul R
  • 2,631
  • 3
  • 38
  • 72
  • You can share the file to give others better idea about the problem. Bad quality is usually related to bad microphone, not to the mono/stereo in wav format. – Nikolay Shmyrev Jul 03 '18 at 00:24

1 Answers1

1

By default Recorder.js records 2 channel audio (by duplicating the mono channel that comes from the mic). To record mono sound instead (and halve the size) use numChannels:1 in the Recorder.js constructor like this:

var rec = new Recorder(source,{numChannels:1})

numChannels is an undocumented feature of Recorder.js but shows up in its js code.

Source (my article): https://blog.addpipe.com/using-recorder-js-to-capture-wav-audio-in-your-html5-web-site/

octavn
  • 3,154
  • 32
  • 49