'Why does audio played in Android emulator sound with echo/noise?

Listen my problem in this short video.

Now I explain in more detail:

In that video I've played (clicking on button) an audio file by three times, twice in a row and the last time with a little pause. First time it sounds like a radio being tuned, second time it sounds clear, but if you click after a little pause then the problem occurs again.

I'm programming in Flutter and I've tested this case by using some other audio packages, but the result is the same, so this problem belongs to Android emulator.

I've tried running emulator by using this command:

$ export QEMU_AUDIO_DRV=pa && emulator -avd dummy_pocoF1

No changes. How can I fix this problem?



Solution 1:[1]

I don't know the cause but I experience it too - it sounds like glitching from the audio pipeline, like the audio buffer size is too small, and the system isn't able to handle the audio quickly enough. As far as I know there's no way to configure that though (which is a shame since different devices have different buffer sizes)

Honestly I think this might be a case of the emulator not being super high performance, so you can get situations where it struggles a little - with graphics that means a lack of smoothness, with audio it means glitching and popping. For me it happens when I first start running audio in an app, and like your video it gradually lessens until it's all nice and clear. I'm guessing the emulator starts to shift some priority to the audio and it takes a while before it smooths out.

Really the best thing you can do is test things on real devices where you can. You could also try giving the emulator process a higher priority on your computer, see if that helps it run better

btw that was some pretty high energy music for a problem demo :D

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cactustictacs