From e4d82483b598e8662558d08e3d19994efe9af326 Mon Sep 17 00:00:00 2001 From: jonathan Date: Wed, 10 Jun 2026 16:21:37 +0200 Subject: [PATCH] docs: code map, regression findings, and HTTP API reference CLAUDE.md gains a function-level code map of web.py/webui.html, a "verifying changes" section (test scope, no-node UI checks, endpoint smoke pattern, Windows commit-message gotcha), and findings recorded as guard rails: why detection must stay adaptive (fixed threshold produced ~600 useless sections/day), why section playback must stay clip-based (libsndfile FLACs have no SEEKTABLE so browser seeks bisect the file), and the five places analysis params are coupled. README gains the adaptive-detection and clip-review features up top, an HTTP API table for scripting, and a corrected Docker analyses-cache paragraph (the rw mount is ./recordings/analyses layered over the ro recordings mount, not a separate ./analyses dir). Co-Authored-By: Claude Fable 5 --- CLAUDE.md | 30 ++++++++++++++++++++++++++---- README.md | 27 ++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 0e33679..f2dae96 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,7 +26,28 @@ python -m pytest tests/ # test suite docker compose up -d / down # web UI mapped to host port 8050 ``` -Dependencies: `requests` (streams), `numpy` + `soundfile` (FLAC output and FLAC/waveform analysis — both optional, code degrades gracefully). +Dependencies: `requests` (streams), `numpy` + `soundfile` (FLAC output and FLAC analysis/clips — both optional, code degrades gracefully). + +## Code map + +`web.py`: +- Detection: `_compute_rms_windows_wav()` / `analyze_flac()` produce 100 ms RMS windows → `_noise_floor_db()` estimates the rolling floor → `_loud_sections()` emits scored sections → `_package_result()` shapes the `/api/analyze` payload. +- Clips: `_api_clip()` validates params, `_clip_wav()` / `_clip_flac()` stream the decoded slice, `_wav_header()` builds the 44-byte PCM header. +- Live headers: `_live_wav_header()`, `_live_flac_header()` (+ `_flac_frame_samples()`, CRC-8 verified). +- Serving: `_stream()` (Range support), `_copy_to_response()`, `_safe_path()` (path traversal guard). + +`webui.html` (one `