Crackling/Popping issues on intel-hda soundcard
Version, Distribution, Desktop Environment:
PipeWire 0.3.33 | Manjaro (Kernel 5.13.12-1-MANJARO) | KDE (5.22.4)
Description of Problem:
I have mostly managed to eliminate the crackling/popping issues with my sound on pipewire thanks to some config tweaking (the tweaks I used are listed below), however there is still some persistent crackling and popping that will occasionally occur and I'd like it entirely eliminated.
Here are my experiences with the issue though:
Alsa: No crackling or popping issues (just other issues instead, like say all the apps that depend on pulse for working audio)
Pulseaudio: Horrid crackling on default settings, unusable, but with certain tweaks (tsched=0 & pulse_latency=60) reduced to mostly manageable levels.
Pipewire: Horrid crackling on default settings, it starts off ok, but as time elapses the cracklings gets worse until every little sound has crackling tacked on to it. With certain tweaks (max-buffers & clock.quantum) not only is the intensity of crackling/popping when it occurs drastically reduced, it also reduces the frequency of the occurrences to manageable levels.
Changing the link.max-buffers setting from 16 to 64 caused a very significant improvement the situation, changing it to 128 didn't seem to change much, changing it to 256 made it a bit worse again (not as bad as at 16 tho)
The quantum setting tweaks also had a significant effect, these particular settings I copied off someone who mentioned it online but I tried tweaking it around and what I found was setting the max-quantum lower lead to more crackling, setting clock.quantum higher broke some audio entirely, and setting it lower lead to more crackling. Setting the min-quantum higher also broke some audio entirely and setting it lower lead to more crackling so these really seem to be about the most optimal settings I can make, but it is not enough.
I tried playing with the clock rates, 44100, 48000 and 96000, I couldn't tell much difference between 44100 and 48000 (but I think 44100 might be good for some applications, like wine, ideally I should be able to set the clock-rate on a per-application basis but I could not figure out any way to do this), 96000 was ok for some audio streams but for others it worsened the situation a lot.
Despite my best efforts I've only been able to bring it down to the occasional crackling or popping noises, and I really wish it could be entirely eliminated.
How Reproducible:
- Requires a soundcard that has the same kind of crackling issues on pipewire (most likely happens most frequently on intel hda soundcards, I've had 4 pcs with intel hda soundcards, all of them had similar issues to this on pulse)
- Crackling almost always at the start of an audio stream or when an audio stream is interrupted (like say buffering on youtube or something)
- Always when changing the volume (might just be because the notification sound counts as start of an audio stream)
- Some applications (most notably some wine applications) will crackle more aggressively (haven't tested yet but setting it to use 44100khz rate might help this issue, I have no thoroughly tested that but I know setting it to 44100khz does not eliminate crackling, but it might reduce it for some applications, reportedly it did on pulse.)
- Some events (for instance in-game events in a video game) will almost always produce a popping or a crackling noise that should not be normally present.
- If EasyEffects is enabled, I get crackling/popping noises every 10-15 minutes or so if I'm in the middle of an audio stream. I think this issue is actually still present without easyeffects but that the noise is barely audible. Conversely some crackling becomes less audible when EasyEffects is enabled too.
Steps to Reproduce:
N/A (Use default settings and see how bad the crackle is?)
Actual Results:
Occasional crackling or popping noises in audio after tweaks to reduce it.
Expected Results:
No crackling or popping noises in audio (preferably with default settings, but I'll settle for after some tweaking instead.)
Additional Info Eg.
pw-dump -N > file
(As Attachment Please):
lspci -v output for related sound device:
00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
DeviceName: Onboard - Sound
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 1272
Flags: bus master, fast devsel, latency 32, IRQ 148, IOMMU group 13
Memory at a5410000 (64-bit, non-prefetchable) [size=16K]
Memory at a5100000 (64-bit, non-prefetchable) [size=1M]
Capabilities: [50] Power Management version 3
Capabilities: [80] Vendor Specific Information: Len=14 <?>
Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel, snd_soc_skl, snd_sof_pci_intel_cnl
pactl info:
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 130
Tile Size: 65472
Server Name: PulseAudio (on PipeWire 0.3.33)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 48000Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_00_1f.3.analog-stereo
Default Source: alsa_input.pci-0000_00_1f.3.analog-stereo
Cookie: fff6:c697
pipewire.conf changes from defaults:
link.max-buffers = 64 # from 16
default.clock.allowed-rates = [ 44100 48000 96000 ] # entirely irrelevant setting, but included it anyways.
default.clock.quantum = 2048 # from 1024
default.clock.min-quantum = 1024 # from 32
default.clock.max-quantum = 4096 # from 8192
pw-dump -N output. (Don't think it contains anything helpful but don't see why not to include it.)
Update: #1569 (comment 1057794)
Partial Solution (improved compared to the one in the OP): #1569 (comment 1102615)