dictate.js icon indicating copy to clipboard operation
dictate.js copied to clipboard

Echo or noise in recorded audio

Open alerenato opened this issue 7 years ago • 4 comments

Hello, I was trying to use the demo doing "Start" and "Stop". The first sentence is correct, but the rest, when listening to the audios, have problems or deletion or echo. Looking at the code and making some queries on the internet (there are several people who have the same issue with getMediaUser) I found that "Stop" could not be pushing the remaining audio, and placed the new audio in the previous "stream". I added a line of code (dictate.js) and the problem is apparently solved.

// Stop recording if (recorder) { recorder.stop(); config.onEvent(MSG_STOP, 'Stopped recording'); // Push the remaining audio to the server recorder.export16kMono(function(blob) { socketSend(blob); socketSend(TAG_END_OF_SENTENCE); recorder.clear(); // Line added }, 'audio/x-raw'); config.onEndOfSpeech(); } else { config.onError(ERR_AUDIO, "Recorder undefined"); } }

I would like to know if you have experienced the same issue and if this solution could be correct. Thanks to advances.

alerenato avatar Nov 29 '17 20:11 alerenato

Thanks for pointing this out! Now that I'm trying it (with Chrome 62.0.3202.94), I also see that sometimes "++garbage++" is being recognized. However, I don't understand what did you change, e.g. your "added line" is already part of the current code (https://github.com/Kaljurand/dictate.js/blob/409e89a2659e4a8104db25b2143b529793fe6cef/lib/dictate.js#L141). Can you offer a pull request to make your change easier to follow? Also, can you point to the internet resources that describe the problem/solution?

Kaljurand avatar Nov 29 '17 21:11 Kaljurand

Excuse me, the line added is wrong. I will try to open a pull request, but for now, I don't know to do.

140 socketSend(TAG_END_OF_SENTENCE); 141 recorder.clear(); 142 }, 'audio/x-raw'); 143 config.onEndOfSpeech(); recorder.clear(); // line added

There is another problem with echo and noise. In the function getUserMedia is necessary to change "googEchoCancellation", "googAutoGainControl", "googNoiseSuppression" to false. I changed some lines too in dictate.js. If I can't open a pull request I will try to send you.

There are some internet resources: https://support.twilio.com/hc/en-us/articles/223180868-How-to-constrain-the-audio-sources-in-Google-Chrome- https://stackoverflow.com/questions/31426551/get-consistent-audio-quality-with-getusermedia-using-different-browsers

Thanks in advance.

alerenato avatar Nov 29 '17 22:11 alerenato

Bother to mention this issue again. Seems that it works fine in the beginning a few minutes, and it becomes worse with echo/noise after 10 to 20 minutes. Does anyone get this kind of issue? Thank you.

YunzhaoLu avatar Jan 21 '23 09:01 YunzhaoLu

To initialize the sampleRate at 16000 to bypass resampling can mitigate the echo/noise around 20 minutes. However, there is longer delay of transcripts after 20 minutes.

YunzhaoLu avatar Jan 23 '23 05:01 YunzhaoLu