When playing music using Spotify, I get some minor distortion every few minutes or so. It’s not obnoxious, lasts probably just a few milliseconds, but it’s noticeable.
Spotify always plays at 44.1 kHz, and my sound output only accepts 48kHz, so there has to be a sample rate conversion.
I haven’t noticed any issues playing from other applications, like Chrome and Firefox, (but it’s harder to notice in videos than music, so can’t be sure).
I’m using HDMI output through a TV, then optical SPDIF from the TV to an amplifier (I will try to get a dedicated sound card with SPDIF, but I don’t have any such output at the moment). It is a virtual machine on a host with a quite old server CPU, VGA passthrough. It’s had no issues on pulseaudio based distros and on a Windows VM.
I’ve tried the trick from here - Audio playback stuttering in Fedora 35 Spin LXDE - with quanta up to 16k. No difference.
pw-metadata -n settings 0 clock.min-quantum 1024
You might try enabling low-latency during boot.
Fedora is considering making this a default in future.
$ man grubby
$ cat /etc/default/grub
$ sudo grubby --args="preempt=full" --update-kernel=ALL
$ cat /etc/default/grub
$ systemctl reboot
 Dynamic Preemption Support Sent In For The Linux 5.12 Kernel - Phoronix
 Issue #228: Enable full preemption - fedora-workstation - Pagure.io
Thanks for the answer. This didn’t solve my problem, but I will keep it.
I’ve installed a PCIe sound card (with passthrough to the VM), so I can use 44.1kHz directly to the DAC now. I also had to enable the sample rate in the pipewire config. It seems like a significant improvement, but there’s still some xruns, happening only about once every 5 mins.
$ cat .config/pipewire/pipewire.conf.d/samplerate.conf
default.clock.quantum = 1024
default.clock.allowed-rates = [44100, 48000, 96000]
There ERR counter in pw-top increases on the app-side, in bursts of 1 to 4 units. I see that it’s negotiated a 8k QUANT for the music player, which is good - no latency requirement there.
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
S 28 0 0 --- --- --- --- 0 Dummy-Driver
S 29 0 0 --- --- --- --- 0 Freewheel-Driver
S 40 0 0 --- --- --- --- 0 Midi-Bridge
S 45 0 0 --- --- --- --- 0 alsa_output.pci-0000_00_09.0.hdmi-stereo
R 46 1024 44100 333.5us 24.6us 0.01 0.00 0 S32LE 2 44100 alsa_output.pci-0000_00_0a.0.iec958-stereo
R 59 8192 44100 154.4us 43.0us 0.01 0.00 4 F32LE 2 44100 + spotify
S 47 0 0 --- --- --- --- 0 alsa_input.pci-0000_00_0a.0.analog-stereo
I encountered the same thing when I listen to the music on Youtube. Any idea what could be the reason?
I think it’s a different issue. For me the problem was primarily cause by two things:
- Pipewire had to do sample rate conversion because I only had output of 48kHz over HDMI. I was trying to play 44kHz audio. Youtube on the other hand will usually use 48kHz.
- The latency of the system is high and unpredictable because of how it was a VM.
Once I fixed the first problem by using a different sound card, the problem was much less bad.
Alex you could have the opposite issue, which is also the same issue. You can try to run
pw-top and check the FORMAT column. If it says
44100 next to
alsa_output....., but 48000 next to the browser, then your pipewire may be stuck at 44100 kHz output and has to do sample rate conversion.
Both formats are marked as 48000
Ok, then sample rate conversion is not a problem. I don’t have any more ideas, hope someone else can figure it out.
I used Windows on the VM for a while, but after adding other loads to the server, even that had distortions every few minutes. The good news is that I tried Fedora again and it works much better than Windows did. Very minimal sound distortions now! This is fantastic, I can finally enjoy music again and not be annoyed when watching youtube videos.
I have a very similar problem.
In my case it looks like the bug occurs if the machine was in
suspend mode before.
There is a way to debug pipewire but no clear answer for me (
PIPEWIRE_DEBUG=5 /usr/bin/deadbeef > debug.log 2>debug.log &
For anyone having a similar problem, at least for me this solved everything!