web-audio-recording-tests icon indicating copy to clipboard operation
web-audio-recording-tests copied to clipboard

Disruption in audio on Android browsers when encoding is enabled

Open namy16 opened this issue 5 years ago • 4 comments

Hi there,

Thank you for this awesome repo, you have done a great job, I'm using this repo from quite a long time and it's working perfectly, however, there is an issue in "Test-6 In Browser Encoding", when I record and play audio in the Android browser (Chrome I have tested), there is a disruption in the audio and this is there for all three encoders in Test6 demo. Please look into this once or suggest me any alternative for this, I want to record audio in .wav format.

namy16 avatar Jul 10 '19 15:07 namy16

I'm glad you've found this repo helpful. Regarding your issue, I just tested with a Google Pixel 2 (Android 9 / Chrome 75.x), and I had no issues with Test 6. The audio/wav option was selected, and I used the default mic on the phone without anything connected. So, I believe your problem is likely hardware/phone/environment specific.

  • What device and Android version are you running?

  • Do you have anything external connected (wired or bluetooth)?

  • Did you reboot phone at some point and retest? Are you able to replicate on a different Android device?

  • Have you done anything that might cause the inbound recording data format to be stereo, instead of mono?

    • That is something I don't think Test 6 handles. You can check if the inbound recording is stereo by using the menu to look at "Diagnostics". On my device, under "Default capabilities, constraints, & settings", I see track[0].settings[channelCount] : 1.

Test 6 uses web workers, and is likely the only test here to do so on Android devices with Chrome. If you've ruled other options out, then my first guess would be something to do with web workers (especially if all the other tests work fine). To see if the issue is related to the web worker, I would've suggested using this demo by Higuma, however, it does not work on Android/Chrome. Still, the underlying code might be of use to you if you need to explore this further.

kaliatech avatar Jul 10 '19 18:07 kaliatech

Thank you for your response,

Please take a look, meanwhile, I will go through the code written by Higuma

namy16 avatar Jul 11 '19 09:07 namy16

You only get this issue when using "Test 6" on the OnePlus 6, and you do not hear the issue with the other tests on the OnePlus 6, such as Test 1. Correct?

On Test 1, does enabling/disabling the echo cancellation make any difference?

A quick google search indicates there were issues with the microphone handling on OnePlus 6 at some point:

  • https://www.androidpolice.com/2019/01/30/oneplus-6-and-6t-wrecking-audio-quality-by-using-the-wrong-mic-in-some-apps-like-snapchat-and-whatsapp/

However, if that was related, it's not obvious how it could be an issue only with Test 6.

kaliatech avatar Jul 11 '19 13:07 kaliatech

Other Tests works fine on all the phones including oneplus6, also enabling/disabling echo cancellation in Test 1 does not make any difference on the oneplus6 as well as Asus and Realme 3, also I'm not using any external microphone. This works perfectly for iPhones and Google pixel series. I recently tried it on Redmi Note 5 pro and another Asus phone and the same issue is still there.

Also, Test 6 does encoding while recording, Is there any way where I can do encoding after recording is done?

namy16 avatar Jul 11 '19 14:07 namy16