Default ALSA latency of 100ms is too high, attempting to reconfigure causes issues
Summary
When using PulseAudio on a 3rd Gen Ryzen CPU (Ryzen 7 3700X), PulseAudio defaults the ALSA latency to 100000us (100ms).
Environment
Without workaround: pa-info-out.txt With workaround: pa-info-out-2.txt
Steps to reproduce
- Use PulseAudio on a 3rd Gen Ryzen CPU (audio device name is "Starship/Matisse HD Audio Controller Analog Stereo")
What is the current bug behavior?
Sound is significantly delayed in games and other audio applications without workaround, video audio sometimes very off-sync or there are two of the same device with workaround, requires pulseaudio -k
to fix.
What is the expected correct behavior?
Sound is not significantly delayed and no workaround necessary.
More information
I recently upgraded my system from a 2010 build with a Phenom II X6 to a Ryzen 7 3700X. I transplanted the drives from my old system to my new one and after a bit of tinkering everything worked fine, except for audio being delayed. For some reason, PulseAudio is configuring the ALSA device "Starship/Matisse HD Audio Controller Analog Stereo" for 100ms worth of delay (Matisse is the codename for Ryzen 3rd Gen). Starting with a fresh PulseAudio config did not resolve the issue.
I came across this article which described the same problem I'm having but with a different audio device:
https://juho.tykkala.fi/Pulseaudio-and-latency
The workaround in this article worked, however it had one problem: It did not describe how to persist the new latency settings. The method involved running a command to automatically remove a sink by specific ID, but since numeric IDs can shift, I determined that this was not reliable for creating a script to do this automatically. Instead I edited /etc/pulse/default.pa
and added this line:
load-module module-alsa-card device_id="1" name="pci-0000_2f_00.4" card_name="alsa_card.pci-0000_2f_00.4" namereg_fail=false tsched=no fixed_latency_range=yes ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1" fragments=4 fragment_size=256
This "works" but it has a few issues:
- Sometimes PulseAudio autodetects the ALSA card before it processes the manual load-module for the same card, resulting in duplicate sinks.
- Sometimes I hear a small pop in audio now and then, usually after waking from suspend (possibly due to me setting the buffer too low, have raised it to 3 fragments, 512 fragment size to try and fix this.)
- Sometimes audio is half a second ahead of video in Chromium. This is utterly baffling and I have no idea why this would happen.
- It will fail if my hardware config changes in the future. I don't want to do this manual override for every possible device I could have plugged in!
If the default ALSA latency could be lowered so that it's no more than 10ms, I would very much appreciate it, and I think other people would too, since Pulse has a reputation for adding 100ms to everything. If the default can't be changed, it would be nice if at least overriding the default latency could be made easier and more reliable.
Thanks!