Files
Stefan ArentzandClaude Fable 5 c90e6f058e Fix speaker clicks: model the AC-coupled speaker
The speaker clicked during game loading with zero $C030 activity (a
20-second Total Replay boot probe showed toggles only during the
power-on beep). Cause: snd.c's synthesis, ported 1:1, held the output
at a DC rail (±8000 forever after the last toggle), so any queue
underrun — a late frame during loading — snapped the output to silence
and back, an artifact real AC-coupled hardware cannot make. It also
dropped whole frames on backpressure and popped at startup.

The synthesis is now a pure, SDL-free Wave: a toggle jumps the level to
a rail (a single toggle still clicks, like real hardware) and the level
decays toward zero with a ~4ms time constant, like the cone relaxing to
rest. Silence is actually silence, so underruns during silence are
inaudible. The queue is primed with 64ms of zeros at startup, all-silent
frames are skipped when the queue is comfortably full, and frames
carrying signal are never dropped.

Five unit tests cover the waveform (idle silence, click-then-decay,
beep-then-silence — the regression test — sample pacing, square-wave
rails). Documented as a deliberate divergence from snd.c in
notes/REWRITE.md; also fixes the README links to REWRITE.md's new
location under notes/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 22:25:07 -04:00
..