Pulseaudio crackling/skipping sound glitches

I use an RX580 with its builtin Ellesmere HDMI Audio soundchip. I connected it to the Monitor via DisplayPort. The monitor has 2 builtin speakers. I have also used an HDMI cable, to see if that would fix it. I tested the Jabra BIZ 2400 USB Headset with pulseaudio and pavucontrol:

turning the volume of the headset up in pavucontrol causes little crackling, but turning the volume up via the analog sound control device of the headset does not cause crackling provided that the volume in pavucontrol is set to 100% (volume there can be set to over 100%).

This bug is a well known one from Pulseaudio and happens to me on VoidLinux.

I have applied every presumable fix provided by the Archlinux Forum aswell as the Archlinux Wiki.

Terminal output after starting Pulseaudio:

W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).
E: [pulseaudio] bluez5-util.c: Failed to get D-Bus connection: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
E: [pulseaudio] module.c: Failed to load module “module-bluez5-discover” (argument: “”): initialization failed.
E: [pulseaudio] module.c: Failed to load module “module-bluetooth-discover” (argument: “”): initialization failed.
E: [pulseaudio] module-console-kit.c: Unable to contact D-Bus system bus: org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket /run/dbus/system_bus_socket: No suc
E: [pulseaudio] module.c: Failed to load module “module-console-kit” (argument: “”): initialization failed.
E: [alsa-sink-USB Audio] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write.
E: [alsa-sink-USB Audio] alsa-sink.c: Most likely this is a bug in the ALSA driver ‘snd_usb_audio’. Please report this issue to the ALSA developers.
E: [alsa-sink-USB Audio] alsa-sink.c: We were woken up with POLLOUT set – however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
W: [alsa-sink-USB Audio] alsa-util.c: Got POLLNVAL from ALSA
W: [alsa-source-USB Audio] alsa-util.c: Could not recover from POLLERR|POLLNVAL|POLLHUP and XRUN: I/O error
E: [alsa-sink-USB Audio] alsa-sink.c: Error opening PCM device front:0: No such file or directory

lspci -nnk:

0002:01:00.0 Non-Volatile memory controller [0108]: Micron/Crucial Technology P2 NVMe PCIe SSD [c0a9:540a] (rev 01)
Subsystem: Micron/Crucial Technology P2 NVMe PCIe SSD [c0a9:540a]
Kernel driver in use: nvme
0004:01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df] (rev e7)
Subsystem: XFX Pine Group Inc. Radeon RX 580 [1682:c580]
Kernel driver in use: amdgpu
0004:01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] [1002:aaf0]
Subsystem: XFX Pine Group Inc. Device [1682:aaf0]
Kernel driver in use: snd_hda_intel

Alsamixer only shows 6 S/PDIF settings.

When the option: ‘options snd-hda-intel model=generic’ is set in /etc/modprobe.d/alsa.conf then alsamixer will only show one S/PDIF option.

trying to play music via mpv outputs:

(+) Audio --aid=1 (mp3 2ch 44100Hz)
ALSA lib confmisc.c:767:(parse_card) cannot find card ‘0’
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
[ao/alsa] Playback open error: No such file or directory
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
[ao/jack] cannot open server
[ao] Failed to initialize audio driver ‘jack’
Could not open/initialize audio device → no sound.
Audio: no audio

according to alsamixer (if option model=generic is disabled):

Card: HDA ATI HDMI
Chip: ATI R6xx HDMI

if option model=generic is enabled:

Chip: ATI Generic

I set CONFIG_SND_DYNAMIC_MINORS in the kernel config
aswell as: “amdgpu.dc=1” and “amdgpu.audio=1” in the kernel commandline, which did not help.

There is less crackling in when I play, say a youtube video via Icecat’s AudioStream than when I play an audiofile via mpv.

Finally, after more than 2 weeks, I bring the solution:

DISCLAIMER: This change will massively reduce stuttering/crackling/popping and only the sound in the browser will work (Firefox and Firefox-based ones are tested and put out sound). Sound in mpv for example does not work.

setup PipeWire:
execute:
“xbps-install pipewire pipewire-pulse alsa-plugins”

“cp -r /usr/share/pipewire /etc/”

comment out these 3 lines in the /etc/pipewire/pipewire.conf:

“default.clock.quantum = 32786
default.clock.min-quantum = 16384
default.clock.max-quantum = 65536”

you will find these in lines 24 to 26. set the values like above.