2 min read

The music wasn't laggy. It flinched every time you landed.

Frame times with the music on and off were identical. Whatever was wrong, it wasn't the engine working harder.

AudioEngineering

The report back after the new soundtrack shipped: the music "seems to play in a laggy way during game play." Two suspects — the CPU cost of the new engine, or the system that ducks the music under sound effects — and only one of them was it.

Not the CPU

Frame times measured with the music on and with it off, over thousands of frames: identical, mean 6.06 milliseconds either way, no long tasks. The audio engine itself costs about 5% of one desktop core, which was already known and already small. That ruled out the obvious explanation in an afternoon.

A tremolo locked to your own landings

Every sound effect was calling the same function to duck the music out of its way — land, perfect, and its echoing octave all fire on one landing, each dipping the music 42 to 50% with a fast attack and a half-second recovery. Landings happen every 0.3 to 0.5 seconds during a real run. That's not an occasional dip. That's the music being pulled down and let back up on almost every single beat of actual play — a rhythm nobody wrote, locked to the player's own landings instead of the song.

82.6% → 1.8%share of 100-millisecond windows where the music sat more than 1 dB under its own resting level — rendered through the real policy, before and after the fix

The fix narrows which sounds get to duck anything at all: only one 0.3 seconds or longer — a death, the RUSH whoosh, an escalation, the last note of a fanfare — dips the music now, by at most 30%, no more than once every 0.6 seconds. A landing, a coin, a click, a bank, a dash, a chirp: none of them touch it anymore. What felt like lag was never the engine falling behind. It was the music being interrupted by the exact thing a player does most.