After moving from Sarpi kernel/modules 4.19.34 to any newer kernel/modules, I started experiencing audio stuttering in Retroarch when launching any game. The stuttering would normally stop after some minutes of running the game. Displaying the framerate on the screen showed that framerate was below 60fps while the stuttering was going on.
Having sound disabled (which happened accidentally when a recent kernel broke the sound module) allowed a normal 60fps framerate. This suggested that the problem was with sound, and I ran across a report of someone having the same issue on an RPi4 so it didn't appear the issue was a performance/computing limitation of the RPi3.
For months I tried various retroarch.cfg settings, changing the selected audio driver, trying different audio/video sync settings and various other suggested tweaks. Nothing helped.
Today, completely by accident (I don't remember how in fact), I ran across a post discussing how to fix audio stutter in Steam on a Raspberry Pi:
https://steamcommunity.com/app/35338...2464753800526/
It suggested to edit
/etc/pulse/default.pa
And change this line:
Code:
load-module module-udev-detect
to:
Code:
load-module module-udev-detect tsched=0
After making this change and rebooting, the change can be verified by running this command below and looking for
tsched=no in the ouput:
Code:
pactl list | grep tsched
Accorcing to the ArchWiki, tsched controls how audio scheduling is done, and this section is relevant:
Quote:
The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach.
Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system.
|
As to why it was newer kernels that made this problem appear? No idea. Maybe some change in kernel timing/scheduling behavior that somehow impacted the sound timing. Or maybe the ALSA driver that comes with newer kernels/modules exposes some issue which is triggered if tsched is enabled.
Total luck finding this solution - not something I'd ever figure out in this lifetime.
References:
Raspberry pi 4 poor audio, stuttering potential fix
https://steamcommunity.com/app/35338...2464753800526/
For pulseaudio what does tsched do (and what are the defaults)?
https://askubuntu.com/questions/371595
PulseAudio/Troubleshooting -> Glitches, skips or crackling
https://wiki.archlinux.org/index.php...roubleshooting