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:
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:
Things that cause 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
- 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
- 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.
- 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.