It really stood out to me in the original recording too. So much so that I dug out my SE and ran Tetris on it to verify. I noticed you were running System 7 and I wonder if there's a background task causing the stuttering.
On my SE with 2.5 megs of memory, running System 6.0.8 without Multi Finder, no extensions like After Dark, and using an old spinning hard disk, I hear no stuttering. If I turn on Multi Finder, I didn't hear anything, maybe a very slight stutter, but that might have been my imagination. I'm not setup to run System 7 on my SE at the moment, but I suspect there's a periodic task running, an extension, or just the system trying to do a lot more that is causing the stuttering.
Back on topic with the accelerator and sound, are there Sound Manager code differences between System 6 and 7 that might be affecting sound distortion? Could fixes for System 7 cause issues in System 6?
I think the ultimate solution is gonna be to develop a slowdown function in the accelerator that exactly mimics the speed of the Mac SE. That will fix any and all speed-dependent problems, no matter the OS.
The origin of the sound problem is that the CPU is too fast and writes to the whole sound buffer before the Mac can finish playing it. This causes a skip in sound playback 60 times per second and the audio output sounds chopped up with this ugly 60 Hz tone superimposed on top from the repeated “pop” that occurs when the skip happens.
More specifically, in the sound manager, when generating four-voice sound, the CPU starts generating samples after vertical blanking approximately in the middle of the sound buffer. This is to basically give the motherboard logic a head start because even an unaccelerated CPU generates samples twice as fast as the motherboard plays them. With an accelerated CPU, this head start is not enough and the corruption occurs. If the CPU is really fast then a large portion of the sound buffer ends up overwritten and the skip is more obvious. If the CPU is only a little faster than stock, less of the sound buffer is overwritten before it can be played and the skip is smaller and less objectionable. Our goal is to slow the CPU down to exactly the right speed so that it does not outrun sound playback. Or maybe it can be a bit slower but we have to immediately disable the extra slowdown once any other I/O chip is accessed.
So whenever the accelerated CPU touches one of the I/O chips or writes to the sound buffer, slowdown will be triggered for the next 28-42 microseconds (0.028-0.042 milliseconds). The slowdown timer is restarted every time another write to the sound buffer occurs so that slowdown happens continuously in the sound manager’s routine to fill the buffer. If we had the slowdown speed exactly right then there would be absolutely zero issues with sound or any I/O device. “PDS-synchronized I/O slowdown” is close but it’s still a little bit faster than the Mac SE in the case where the CPU “thinks” in between bus cycles. Hence the sound is still a little messed up.
You can see this in the Speedometer results where I permanently enabled slowdown. In the CPU test, which could more accurately be called the memory latency test, the CPU’s performance is bus-limited, so the results are almost identical between the Mac SE and WarpSE. That is, there are very few instruction sequences in the CPU benchmark where the bus cycles are not back-to-back. But in the graphics and math tests, the instructions used end up causing the 68k to read some data from memory and then chew on it for a few clocks before doing another bus cycle. So the increased frequency helps in the math and graphics tests and the performance is faster than stock, which is not desirable during slowdown.
Therefore I have developed a new slowdown technique. During slowdown, all transactions will still be put out on the PDS to equalize the bus speed to stock, but instead of also putting 16 wait states, which was fairly heavy-handed, I’m gonna have the WarpSE skip sending some clock pulses to the fast CPU when the bus is idle. The logic in the fast clock domain will watch the 7.8336 MHz clock of the Mac and only pulse the fast CPU clock right after a 7.8336 MHz clock pulse occurs. This is tricky because there are some statistical/discrete math kind of subtleties relating to the relative phase of the 7.8336 MHz and 25 MHz clocks so the accelerator could still be a hair faster than stock during slowdown but I think it will be fine.
That’s the idea, that during slowdown the WarpSE will get as close as possible to how a regular Mac SE performs. Overall performance during four-voice sound playback will be around 16 MHz speed since the WarpSE spends half of the CPU at 7.8336 MHz and the other half of the time at 25 MHz. So the average is like 16.4 MHz. Single-voice sampled sound will be much faster since a smaller amount of time is spent writing to the sound buffer. I’ve written the code for this and will be trying it soon.