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 `