v0.9.3 — Audio crackle fix
This release fixes the crackling in cutscenes, menus and matches (#30).
It also includes everything from v0.9.2 (the opt-in debug switches to unlock everything for
testing), which was never published on its own.
Changes
- No more crackle. The game mixes its music and speech into a small looping buffer, 50 ms
long, that the audio chip plays over and over. A game thread refills it every 10 ms and stays
about 21 ms ahead of what's playing. When it ran late, the old part of the buffer played
again, and that was the crackle. It ran late because of the port, not the game:- the game's millisecond clock (
KeTickCount) stood still for 12–18 ms at a time, so the
thread overslept. It now has its own clock thread. This was the biggest cause, and it's
shared code on every platform. - on macOS, the system woke the thread 3–4 ms late to save power, and the thread waited
behind other game threads during scene loads. The game's time-critical threads now wake on
time and run first. - on macOS, the thread that produces the sound now gets the same priority as the game's
threads, so the output device no longer runs dry in busy fights (10 gaps in a four-minute
four-fighter fight before, none after). - two fixes from the Steam Deck investigation: the voice resampler reads 8 samples ahead of
the play position instead of 64 (clicks in menus and music), and the audio chip works through
each 0.67 ms slice of audio at its own moment instead of in bursts (Linux and macOS).
- the game's millisecond clock (
- Each fix can be switched off to compare:
RECOMP_TICK_THREAD=0,RECOMP_PRECISE_SLEEP=0,
RECOMP_GUEST_TURN_PRIO=0,RECOMP_GUEST_QOS=0,RECOMP_APU_SLICE_PACE=0. scripts/audio-holes.pycounts the places where old audio was replayed, from a
RECOMP_APU_VOICE_PCMdump.
Validation
Measured on a Mac (Apple Silicon) with the opening Story scene (D-Mob's arrest and the car
crash): before the fix the game's mix had about 10 holes a second; with it, 5 in the whole
four-minute run. A play-test on the Mac confirmed it by ear. The full regression passes 15 of 17
checks; the two misses are the output-device audio gate, which then improved with the
last change (the versus gate now passes, combat had one gap). All 25 CI checks on the pull
request passed. Windows and the Steam Deck were not play-tested for this release; CI builds
them, and the clock fix applies to both.
Known limits
- One short skip remains as the car crash hits in the opening scene. That moment is the heaviest
frame in the scene, and the skip is left for future performance work. - The output device can still run dry briefly after a very long frame, much more rarely than
before (theaudio.dry_queuecheck).
Updating
Run the setup for your platform and update the existing installation. The setup builds the
game locally from your own dump and preserves player data.