I was going to experiment with a few different systems and OSes to see if it was any difference in hardware. Unfortunately, I don't have the room to set up a bunch of my systems at the moment.
I did try a laptop that had a core i5-4300U @ 1.90 ghz with ubuntu 22.04.1 and it didn't seem to have a lot of the underruns.
lspci says that it has a "Haswell-ULT Integrated Graphics Controller" and a "Haswell-ULT HD Audio Controller".
It also has the mockingboard showing "activity" when it's idle.
Maybe other processes on the system are causing problems.
I wonder if it has something to do with other tasks running on the system like Firefox and having a bunch of windows and tabs open.,
Try xorg vs wayland
Try different cpu / sound hardware.
Hmmmm. I fired up audacity to monitor and record the sound, dropping out different channels in the Slider Controls and I noticed that leaving one channel of the AY8913 running it seems to create an intermittent signal: (edit: with -video opengl and the Slider Controls window active)
Left of the bar is it set to 2.0, right of the bar is it set to 1.0.
and if I turn the sound way up on my headphones, it sounds very poppy and crackly.
Putting mame on pause, then playing the sound recorded on a loop in Audacity with Shift+Space the sound is exactly the same pops and crackles.
Interestingly turning on channel 1 + 2 will give you a "straight line".
right of the line is channel 1 and 2 set to 1.0 with channel 0 set to 0.0.
Hmmmm. I noticed that it was kind of intermittent when I had the slider window open with all of the UI text under -video opengl.
Moving to -video bgfx with -video_backend opengl audacity records a straight line.
Toggling the UI with TAB and all the slider text (with -video opengl), you can see the levels "bouncing" slightly in pavucontrol.