···5151- Memory ops (`peek/poke` 1/2/4/8‑bit, `memcpy`, `memset`) implemented; VRAM updates reflect on screen.
5252- CLI loads bundled default cart or a provided `.lua` path.
5353- Audio capture foundation: `cpal` input stream with mono downmix into a lock‑free ring buffer (8192 samples); CLI flags `--list-audio`, `--audio-device`, `--audio-vu`, `--audio-disable`; simple VU feedback prints peak dBFS once per second.
5454- - FFT foundation: 2k R2C (`realfft`) updates on the tick thread; maintains raw/smoothed/normalized buffers with peak tracking; `--debug-fft` prints first bins; Lua APIs pending.
5454+ - FFT: 2k R2C (`realfft`) on tick thread; maintains raw/smoothed/normalized buffers with peak tracking; `--debug-fft` throttled print; Lua `fft/ffts/fftr/fftrs` wired with C-identical clamping/sum semantics; headless tests added; simple cart at `assets/fft_test.lua`.
55555656**Near-Term Backlog**
5757- FFT implementation (cpal + realfft) per `docs/specs/audio_fft_vqt.md` (see Implementation TODOs section); add headless tests and Lua `fft/ffts/fftr/fftrs`.
···9797 - Implemented audio capture with `cpal`: device selection/listing, mono downmix, ring buffer.
9898 - Added CLI: `--list-audio`, `--audio-device`, `--audio-vu`, `--audio-disable`.
9999 - Integrated a 1s VU peak readout for manual verification.
100100- - Implemented 2k FFT analysis (realfft) with normalized/smoothed buffers and debug print flag.
100100+ - Implemented 2k FFT analysis (realfft) with normalized/smoothed buffers and debug print flag; wired Lua FFT APIs; added headless tests and an FFT test cart.
101101 - Kept clippy/tests green; documented the FFT/VQT plan and linked TODOs.
102102103103**Docs Index**
+1-1
docs/specs/audio_fft_vqt.md
···87878888Status
8989- Phase 1 implemented: `cpal` capture + mono downmix + ring buffer + CLI flags + VU feedback.
9090-- Phase 2 implemented: FFT 2k using `realfft` (tick‑thread), raw/smoothed/normalized buffers and peak tracking; optional `--debug-fft`. Lua wiring and tests next.
9090+- Phase 2 implemented: FFT 2k using `realfft` (tick‑thread), raw/smoothed/normalized buffers and peak tracking; Lua `fft/ffts/fftr/fftrs` wired (C-identical semantics), headless tests added; optional `--debug-fft`.
91919292Phase 1: Audio (cpal)
9393- Device listing: Add `--list-audio` to print capture devices and default.
+3-2
docs/specs/implementation_status.md
···3535 - Bins 0..1023 maintained (Nyquist dropped), magnitudes scaled by 2.0 to match C behavior.
3636 - Buffers: raw, raw‑smoothed (0.6), normalized, normalized‑smoothed, with peak tracking (`fPeakMin=0.01`, `fPeakSmooth=0.995`).
3737 - Optional `--debug-fft` prints the first 16 smoothed normalized bins periodically.
3838- - Lua APIs pending wiring (`fft/ffts/fftr/fftrs`).
3838+ - Lua APIs implemented: `fft/ffts/fftr/fftrs` with C-identical clamping/sum semantics.
3939+ - Tests: headless unit tests cover raw-peak behavior and Lua bridging; additional clamp/sum range tests added.
39404041Behavioral Notes
4142- Triangles: top-left inclusion; CCW orientation enforced internally; half-open bounding box prevents shared-edge double draws.
···5354- Audio
5455 - `sfx`, `music`; audio mixer/synth; capture ring for analysis.
5556- Analysis
5656- - `fft/ffts/fftr/fftrs`, `vqt/vqts/vqtr/vqtrs` and whitening variants; behavior per CLAUDE.md.
5757+ - `vqt/vqts/vqtr/vqtrs` and whitening variants; behavior per CLAUDE.md.
5758- Sprite flags
5859 - `fget`, `fset`.
5960
+6
docs/testing/test_catalog.md
···4444 - `memcpy_and_memset_affect_vram`: VRAM writes via memcpy/memset reach the screen.
4545 - `peek_poke_bits_general_ram`: 1/4-bit addressing in general RAM behaves correctly.
46464747+## FFT Tests
4848+- `tic80_rust/tests/fft_tests.rs`
4949+ - `fft_query_peak_at_bin`: Bin-aligned sine produces a distinct raw peak at the expected bin versus neighbors.
5050+ - `lua_fft_returns_normalized_bin`: Verifies Lua `fft(k)` returns normalized magnitude by gating a pixel.
5151+ - `fft_query_range_clamps_and_sums`: Clamping and inclusive sum behavior matches C (OOB handling and range sums).
5252+4753Notes
4854- Tests prefer headless framebuffer inspection over image baselines.
4955- Hashing uses FNV‑1a over VRAM palette indices for portability and stability.