I didn't use to have this problem but lately, while I have Google's Android emulator running, my system audio (not talking about the emulator's audio) sounds very distorted and metallic. Sometimes it will work fine for a minute and then start to sound messed up again. As soon as I shut down the emulator, everything sounds fine. I'm having this problem whether I use speakers or headphones. I'm on Ubuntu 18.04 with the latest version of Android Studio.
Does anybody have any clue as to a fix or workaround?
Edit: As a workaround I'm starting the emulator from the terminal with
emulator -noaudio -avd my_avd
This seems to fix the sound issues but is obviously not an ideal solution.
I did what was written on this link and it solved the problem for me.
In /etc/pulse/default.pa change
load-module module-udev-detect
toload-module module-udev-detect tsched=0
and in /etc/pulse/daemon.conf change
; default-sample-rate = 44100
todefault-sample-rate = 48000
Finally, restart pulseaudio with
pulseaudio -k
(or you simply restart the computer)