After the last update of gnome I’ve heard some stuttering or distortions when playing audio, e.g. youtube videos. It seems, that there is some buffer underflow of audio data while transfering it to the audio hardware. And the audio hardware doesn’t get a continous stream of data and thus needs to do little pauses when playing back audio which is very annoying.
Audio in modern desktop environments takes a complex path: the software, e.g. your web browser, sends the audio to a pulse audio channel. Pulse audio takes the sound data and forwards it somewhere else. In my case I think, the next stop is pipewire, which connects the audio data then to the real hardware, which is addressed via alsa. Somewhere on the way, my computer is too slow, so that audio data is not delivered fast enough to the hardware.
But there is a solution: buffering. It has a downside, though: it adds latency, but that’s ok if it is not too big.
So here’s what you can do:
mkdir -p ~/.config/pipewire cp /usr/share/pipewire/pipewire-pulse.conf ~/.config/pipewire/
Then edit the file
~/.config/pipewire/pipewire-pulse.conf. E.g. I increased “pulse.min.req” and “pulse.default.req”:
pulse.min.req = 960/48000 # 20 millis instead of default 5ms pulse.default.req = 9600/48000 # 200 millis instead of default 20ms
The values are explained here: https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PulseAudio.
After logout/login the new settings are applied and I no longer have distortions while playing back audio.