Audio pops and clicks on Linux only

Hello,

I’m using Retroarch 1.22 on Fedora with pipewire and vulkan, and an NVidia GTX 1660 GPU. On all cores, I have audio pops, especially after the game starts for a few seconds, and then occasionally during gameplay. It’s not a speed issue because when I fast-forward a game I get ~3000 fps.

On Windows 10 the same games / cores run fine without pops.

I’ve tried the following :

  • Increasing / decreasing audio_max_timing_skew
  • Increasing / decreasing audio_rate_control_delta
  • Changing the audio driver to pulseaudio
  • Changing the video driver to gl.
  • Increasing audio latency from 64 ms to 256 ms

The only way to prevent these pops was to disable V-Sync, but then the framerate visibly drops to ~15 fps and looks irregular. As I understand it, disabling V-Sync may introduce some occasional tearing, but it should not cause such a framerate drop. When disabling V-Sync on Windows, the framerate stays smooth. It seems I have some serious sync issues on Linux. Maybe a driver problem ? The driver is set to always run on the maximum power state (P0), so it shouldn’t be a power management problem.

Thanks for any suggestions.

Are you using wayland or X? If the former, can you try the latter?

@Cutter Also, please provide some log and try to make a test with nightly build. Thank you.

I’m running Retroarch on Gnome + Wayland. I ran it on XFCE + X11 for comparison because Gnome only supports Wayland. Pops / clicks also happened on X11, maybe less often, it’s hard to tell. When they occur the dropped frame counter increases.

Here are the logs:

Log of Retroarch on X11 (Fedora XFCE)

retroarch.cfg (X11)

glxinfo:

$ glxinfo | grep -i nvidia
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1660/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 595.80
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL version string: 4.6.0 NVIDIA 595.80
OpenGL shading language version string: 4.60 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 595.80

Log of Retroarch on Wayland (Fedora Gnome)

retroarch.cfg (Wayland)

glxinfo:

$ glxinfo | grep NVI
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1660/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 595.80
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL version string: 4.6.0 NVIDIA 595.80
OpenGL shading language version string: 4.60 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 595.80

Switching from the NVIDIA proprietary driver to the open source driver nouveau didn’t solve the audio pops.

Enabling threaded video replaces audio pops with framerate stutters.

It seems you don’t have default for ?

audio_max_timing_skew = "0.010000"
audio_rate_control_delta = "0.001000"

Can you try with the nightly which is an AppImage as you will get default settings (and it won’t interfere with your current installation)

curl -O https://buildbot.libretro.com/nightly/linux/x86_64/RetroArch.7z
7z x RetroArch.7z
cd RetroArch-Linux-x86_64
./RetroArch-Linux-x86_64.AppImage

Thank you.

I tried the nightly with default values for the two settings, audio pops / clicks still occurred.

Hey there,

You can check pops resulting from pipewire’s buffer underruns (ERR) with the command

pw-top

Pipewire use default latency values from its conf file, usually /etc/pipewire/pipewire.conf.

You can edit that file with gedit or another editor of your choice as super user.

sudo gedit /etc/pipewire/pipewire.conf

A while ago after changing card, I had issues with pops and crackles under load, not specific with retroarch tho, so I dont know if it could help you, but anyway, here we go… I edited the file to tweak the values of

default.clock.rate          = 48000
default.clock.allowed-rates = [ 48000  ]

default.clock.quantum       = 2048
default.clock.min-quantum   = 64
default.clock.max-quantum   = 4096

These are the samplerate and number of sample per buffer, which is variable per application in pipewire if I understood correctly. So not a value in ms, but quantum divided by clock rate will give you the latency in second. Depending on your soundcard driver you should be able to find a default sweet spot value so that the audio doesn’t pop under heavy CPU load. My default quantum value here for the intel onboard sound is 1024, I had to increase it from its default. Reducing the min-max fork values also helped. YMMV.

Effects only apply after a pipewire service restart.

Minimizing audio latency may require installing a real-time kernel at some point, going back to ALSA-Jack, but that’s another rabbit hole. GLHF!

Thanks. The pops are specific to Retroarch, I don’t get them with most programs. pw-top doesn’t show any errors for Retroarch when pops occur (the error counter stays at 0).

I’ve noticed that the pops occur more often when other applications are running besides Retroarch (for example, the Gnome Resources app). It looks like Retroarch is highly sensitive to other apps taking some CPU time, despite the fact that both process consume no more than ~1.5 % CPU.