Symptoms
Whenever I plug an audio jack into my PC a loud crackling can be heard in the headphones (tried 2 different pairs), it also happens whenever I play a sound if I didn't already have another audio playing in the last few seconds.
It is as if an audio service or card were putting itself to sleep after a few dozen seconds of inactivity and resuming it would cause a single crackling noise then the audio is clean again. A similar but much less agressive sound is heard a few seconds after an audio is done playing.
The crackling sound is much louder at its first instance (after boot) than any other time, it also happens whenever I plug in headphones or when the pc turns off.
System
I use a clean install of Parrot OS 5.0 (LTS) (debian based) on a stock HP ENVY PHOENIX 860-080nz 1.04(except for the storage), the issue was there from day one.
Here is the output of cat /proc/asound/cards
0 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xdf320000 irq 129
1 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xdf080000 irq 17
2 [AUDIO ]: USB-Audio - USB AUDIO
USB AUDIO at usb-0000:00:14.0-7, full speed
Devices 0 and 1 use the snd_hda_intel driver which is native to the kernel, I didn't touch this.
Here is cropped output of lspci -v
01:00.1 Audio device: NVIDIA Corporation GM200 High Definition Audio (rev a1)
Subsystem: Hewlett-Packard Company GM200 High Definition Audio
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at df080000 (32-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
[...]
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
DeviceName: Onboard Audio
Subsystem: Hewlett-Packard Company 100 Series/C230 Series Chipset Family HD Audio Controller
Flags: bus master, fast devsel, latency 32, IRQ 129
Memory at df320000 (64-bit, non-prefetchable) [size=16K]
Memory at df300000 (64-bit, non-prefetchable) [size=64K]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
Other tests I did
USB speakers work perfectly fine.
This happens whether I am in headless mode or not (I suspected it might be KDE as the first crackling at boot comes during the KDE splash logo)
I dual boot with windows and have no such issues on the Windows side so I'm certain it's no hardware issue.