Sound crackling with Nvidia card

scf@

Developer
Every so often I here crackling during sound playback. It could happen while watching YouTube in Firefox or playing a video or audio file with mpv. "Did I hear something in the music track? Perhaps, the rip had a mistake or the CD has a scratch." I have tried to localize this issue for quite awhile. My motherboard has a Realtek ALC4080 (USB) chipset, so I have tried to find if it was a BIOS issue or a setting I made in /etc/sysctl.conf. The hardest part is that I did not know how to replicate it.

Well, finally, I have a way to do it easily. Start playing an MP3 file (or even cat a WAV file into /dev/dsp to rule out the software then run this script:

sh:
while [ ${?} -eq 0 ]
do
    nvidia-settings -q OpenGLVersion > /dev/null
done

That produce a decent amount of distortion for me. From watching with "vmstat -i 1", I see that playing music causes XHCI to use 8000 interrupts/sec. Now, with that little script, it falls to 4000-6000 interrupts/sec with all the CPU timers showing a few hundred each.

NOTE: xhci0 may be at 8000 at times without anything playing, but an app may still have a hold on /dev/dsp?
NOTE: cpu20 is an outlier for some reason.

System at rest or during playback of MP3:
Code:
cpu0:timer                            50         25
cpu1:timer                            95         47
cpu2:timer                            25         12
cpu3:timer                            13          6
cpu4:timer                            12          6
...
cpu20:timer                         2254       1126
...
irq129: xhci0                      16011       8001
...
irq174: vgapci0                      311        155
Total                              21166      10567

Code:
With polling from nvidia-settings:
cpu0:timer                          2679        535
cpu1:timer                          1959        391
cpu2:timer                          2200        440
cpu3:timer                          1920        384
cpu4:timer                          2395        479
...
cpu20:timer                         3997        799
...
irq129: xhci0                      24643       4925
...
irq174: vgapci0                     2549        509
Total                              91086      18203

Things that cause it:
  • glinfo > /dev/null
  • glxinfo > /dev/null
  • glxinfo -B > /dev/null
  • nvidia-settings -E > /dev/null
  • nvidia-settings -L > /dev/null
  • nvidia-settings -g > /dev/null
  • nvidia-settings -k > /dev/null
  • nvidia-settings -q all > /dev/null
Things that do not:
  • nvidia-smi -q > /dev/null
  • nvidia-settings -q screens -q gpus > /dev/null
  • nvidia-settings -q screens -q gpus -q framelocks -q fans -q thermalsensors -q svps -q dpys > /dev/null
  • nvidia-settings -q OpenGLImageSettings > /dev/null
  • Running multiple VMs.
  • Running poudriere builders.
  • Running a simple program I wrote to open and close repeatedly the following devices:
    • /dev/dri/card0
    • /dev/dri/renderD128
    • /dev/nvidia-modeset
    • /dev/nvidia0
    • /dev/nvidiactl
I am not sure what can be done or even how or where to report this issue since it could be:
  • My motherboard (Asus Z790-F Wi-Fi). Defect or the ALC4080.
  • Undervolting the CPU. Yes, I am one of those people. :) However, I would be surprised that polling the OpenGL version could do so much to a system.
  • GPU defect: PNY GEFORCE RTX™ 4070 XLR8 Gaming VERTO Edition
  • Nvidia driver: Currently, I am using 570.144 but any driver over the last year, I think.
  • FreeBSD 14-STABLE sound driver.
Things I have tried to fix it:
  • Tried reducing undervolting, but noticed no change.
  • Switched hw.acpi.cpu.cx_lowest back to C1. No change.
  • Removed a lot of sound settings I had in /etc/sysctl.conf to go to default. No change.
  • hw.usb.uaudio.buffer_ms=8. This is the only thing that has reduced it, by a lot. However, it still happens.
I did find this mpv issue #15775, but I do not think that is the same problem since vlc works well for them. Otherwise, it is an issue with the nvidia driver or possibly system timers? Hence, my dilemna: where do I continue for reporting this? I may consider getting an inexpensive PCI-e sound card (with an EMU10K1), but I do want it fixed to help others who may be frustated as much as I have been.
 
Have you tried with your user in realtime/idletime groups, and running lets say mpv in realtime priority ?
No change with running sudo rtprio 31 mpv file.mp3.

Interestingly, I noticed that my cursor runs slower and jumpy in an xterm when running that loop (without the music) while changing the query to OpenGLImageSettings does not have the problem. So, it is not just sound that is affected. Hmm.
 
Yes I have had interference from graphics Cards on analog sound . At some point I tested the PC's digital sound output to a DAC ( Digital-Analog-Converter) that was placed som meter or so away from the computer with analog Audi cables from the DAC to speakers , this did remove the Noise from the Audio stream.
I dont have any figures on the amountof RadioFrequencyInterference ( RFI) thats generated from a GPU , but with a soundcard next to the GPU the interference is noticable.
 
I am planning on getting the PCI-e sound card to see if that fixes my issue since I have a feeling the GPU/driver is causing issues with the USB bus since dragging an xterm also suffers.

I just created a new topic on the Nvidia forum for this and also found mention of someone else with Windows on a similar motherboard switching to a dedicated sound card:
 
Hey, i got the same problem. Using Nvidia card, crackling sound,... tried everything. Even installed pci-e soundcard and still crackles. Did you found the solution?
 
Hey, i got the same problem. Using Nvidia card, crackling sound,... tried everything. Even installed pci-e soundcard and still crackles. Did you found the solution?
Sadly, I have not found a solution. Using a sound card did reduce it some, yet the issue is still there.
 
Back
Top