Skip to content

docs: correct drift in user docs + stale rate comments - #137

Merged
kfox merged 5 commits into
mainfrom
docs-drift-correction
Jul 20, 2026
Merged

docs: correct drift in user docs + stale rate comments#137
kfox merged 5 commits into
mainfrom
docs-drift-correction

Conversation

@kfox

@kfox kfox commented Jul 20, 2026

Copy link
Copy Markdown
Owner

User-facing docs (README.md, docs/) had drifted from the code. This corrects the drift across five independently-reviewable commits, plus a sweep of stale audio-rate references in code comments. Docs + comments only — no behavior change; the full test suite (2633 tests) and make lint are green.

Phases

  1. docs/troubleshooting.md — audio symptom sections: default rate 8 kHz→12 kHz; the CIA docs: document scripts/c64cast.sh launcher #2 Timer A latch is derived from sample_rate so higher rates keep pitch correct and are rejected at load past the ~13.6 kHz NTSC handler ceiling (not "wrong pitch"); bit depth is [audio].dac_curve (Mahoney ~6-7-bit by default on the U64, not flat 4-bit); mic "no audio" advice now points at the [dsp] downward expander (noise_gate only applies when [dsp].enabled = false).
  2. docs/caveats.md — "Audio is intentionally lo-fi": ~10.5 kHz→12 kHz, same pitch/dac_curve corrections, [dsp] chain (ON by default) supersedes the old "noise_gate/mic_sensitivity are the only shaping knobs" claim.
  3. docs/usage.md — "7 scene types"→10; mcm is 80×50 multicolor char via an uploaded 2×2 charset (was 40×25 text); generative sources 3→20 + the blur effect + per-scene pre_emphasis; extras table gains tr/vision/camera/yt/wled; new [hardware]/[teensyrom]/[dsp]/[color]/[midi_control] config sections + [ultimate64] reconciled with the [hardware].backend split; [audio] gains dac_curve/sampler_clock_hz; CLI table fixes (-v/-vv both DEBUG; -d takes index/name/VID:PID).
  4. README.md — generative "~20 procedural sources"; audio DAC Mahoney note; make target list synced to actual output (sync/fmt/doctor).
  5. Code-comment rate sweep (audio.py, audio_marker.py, dsp.py) — stale 8/10.5 kHz references corrected to the 12 kHz default (load-bearing figures recomputed; drift-prone "@ 8 kHz" duration color removed). Deliberately kept: the CIA-latch worked examples, the historical 6581 PWM/badline measurements, and dac_calibration.py's own intentionally-pinned NMI_RATE = 8000.

Every corrected catalog was cross-checked against the introspection commands (--list-scenes/--list-modes, --describe scene:generative|mode:mcm|section:dsp|section:color|section:audio).

Not in this PR

A full docs/architecture.md audit (it has its own stale rate refs + per-module narratives to verify) is deferred as a tracked follow-up.

kfox added 5 commits July 19, 2026 15:59
The audio-quality and mic sections had drifted from the code:
- Default sample_rate is 12000 Hz, not 8 kHz; the CIA #2 Timer A latch
  is derived from sample_rate, so higher rates keep pitch correct and are
  rejected at load past the ~13.6 kHz NTSC handler ceiling (they do not
  "play at the wrong pitch"). The live pipeline underruns around ~12.5 kHz.
- Bit depth is set by [audio].dac_curve, not the rate: the "auto" default
  already uses the Mahoney ~6-7-bit $D418 technique on the U64's emulated
  SID, and U64 video audio defaults to the off-bus sampler, not the DAC.
- noise_gate only applies when [dsp].enabled = false; point the mic advice
  at the [dsp] downward expander (expander_threshold_db), which is ON by
  default and replaces the hard gate.
- ~10.5 kHz → 12 kHz default; replace the "different rate just plays at
  the wrong pitch / nothing resamples" claim with the pitch-adaptive CIA
  timer + load-reject ceiling behavior.
- Add the [audio].dac_curve nuance: "auto" default uses the Mahoney
  ~6-7-bit $D418 technique on the U64's emulated SID (and --calibrate-dac
  for a physical SID); 4-bit linear is only the uncalibrated fallback.
- Replace "noise_gate/mic_sensitivity are the only shaping knobs" with the
  [dsp] chain (ON by default, expander replaces the hard gate); noise_gate
  only applies when [dsp].enabled = false.
- Catalogs: "7 scene types" → 10; mcm mode is 80×50 char via an uploaded
  2×2 charset (was 40×25 text); generative sources 3 → 20; add the `blur`
  effect and the per-scene `pre_emphasis`.
- Extras table: add tr, vision, camera, yt, wled.
- Config sections: add [hardware], [teensyrom], [dsp], top-level [color],
  and [midi_control]; reconcile [ultimate64] with the [hardware].backend
  split (+ sid_model); [audio] gains dac_curve/sampler_clock_hz, reframes
  noise_gate as superseded by [dsp], and points at the pitch/tempo/reu knobs.
- CLI table: -v/-vv both enable DEBUG (default INFO); -d takes index/name/
  VID:PID.
- Generative feature bullet: ~20 procedural sources (was plasma/tunnel/
  fire), add the blur effect.
- Display+audio summary: soften "4-bit $D418 DAC" to note the Mahoney
  ~6-7-bit companding path.
- Make targets: sync to actual `make` output (add sync/fmt/doctor; fix
  test/coverage descriptions).
The [audio].sample_rate default is 12000 Hz, but several comments still
referenced 8 kHz / 10.5 kHz as the operating rate. Comment/docstring only —
no behavior change.

- audio.py: module docstring 10.5 kHz → 12 kHz (Nyquist ~6.0 kHz); correct
  the load-bearing derived figures to the 12 kHz default (STOMP guard ms,
  sample-tap FFT floor, servo time constant, REU-mic bootstrap latency,
  MAX_QUEUED_SAMPLES cap); drop drift-prone "@ 8 kHz" duration color from
  fixed byte-size constants (ring, half-ring margin, mic ring); generalize
  the consumer-rate prose to "the configured sample_rate".
- audio_marker.py: marker Nyquist note → 12 kHz; note DEFAULT_PLAYBACK_RATE
  no longer tracks the app default; generalize the staircase docstring.
- dsp.py: perf note "At 8 kHz" → "At the DAC sample rate".

Deliberately kept: the CIA-latch worked examples (NTSC@8kHz: latch=127),
the historical 6581 PWM/badline measurements, the REU-pump 8 kHz special
case (framed as historical), and dac_calibration.py's own pinned
NMI_RATE = 8000 (a fixed calibration rate, not the app default).
@kfox
kfox merged commit 1479966 into main Jul 20, 2026
7 checks passed
@kfox
kfox deleted the docs-drift-correction branch July 20, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant