Skip to content

Star Fox v0.0.3 - audio crackle fixed

Choose a tag to compare

@mstan mstan released this 06 Aug 01:58
· 79 commits to main since this release

Audio: family-wide crackle fixed

The shared engine retired a hardcoded 534 output samples per audio callback
regardless of how many the host actually asked for, so consumption tracked the
callback rate and ignored the callback size. Any host not asking for exactly
534 drove the DSP output ring permanently out of balance.

Measured on the Super Mario Kart port before the fix: 17.8 k samples/s consumed
against 32.04 k/s produced, the ring pinned at its cap, and 43% of every audio
sample generated was discarded
- 384,032 of them carrying audible music - in
64,935 separate drop runs. Tempo survived because the drops landed as thousands
of very short runs per second, which is why this was heard as static rather than
as obviously wrong pitch.

The consumer now retires exactly as many samples as it emits frames, converts
the SPC's native 32040 Hz onto the device rate with continuous-phase
interpolation, and steers ring occupancy with a +/-0.5% servo (about 8 cents,
well below audibility) so the guest and the audio device can no longer drift
apart. Starvation fades over 64 frames instead of cutting to silence.

After the fix, same measurement: 0 samples dropped, 0 audible drops, 0 drop
runs, occupancy stable, consumed/produced 0.999, no steady-state underruns.

Engine: snesrecomp 1c271f9 + ad7860b. Launcher: recomp-ui 58e9d72.

Also fixed here

This title opened the audio device at 32000 Hz while the SPC produces 32040 Hz.
That 40 samples/s surplus filled the output ring after about 178 seconds, so the
crackle appeared a few minutes into play and then never left. It now opens at the
true native rate.