diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-06 11:12:34 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-06 11:12:34 +0100 |
| commit | 5a1adde097e489c259bd052971546e95683c3596 (patch) | |
| tree | bf03cf8b803604638ad84ddd9cc26de64baea64f /TODO.md | |
| parent | 83f34fb955524c09b7f3e124b97c3d4feef02a0c (diff) | |
feat(audio): Add Spectral Brush runtime (Phase 1 of Task #5)
Implement C++ runtime foundation for procedural audio tracing tool.
Changes:
- Created spectral_brush.h/cc with core API
- Linear Bezier interpolation
- Vertical profile evaluation (Gaussian, Decaying Sinusoid, Noise)
- draw_bezier_curve() for spectrogram rendering
- Home-brew deterministic RNG for noise profile
- Added comprehensive unit tests (test_spectral_brush.cc)
- Tests Bezier interpolation, profiles, edge cases
- Tests full spectrogram rendering pipeline
- All 9 tests pass
- Integrated into CMake build system
- Fixed test_assets.cc include (asset_manager_utils.h)
Design:
- Spectral Brush = Central Curve (Bezier) + Vertical Profile
- Enables 50-100x compression (5KB .spec to 100 bytes C++ code)
- Future: Cubic Bezier, composite profiles, multi-dimensional curves
Documentation:
- Added doc/SPECTRAL_BRUSH_EDITOR.md (complete architecture)
- Updated TODO.md with Phase 1-4 implementation plan
- Updated PROJECT_CONTEXT.md to mark Task #5 in progress
Test results: 21/21 tests pass (100%)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'TODO.md')
| -rw-r--r-- | TODO.md | 70 |
1 files changed, 70 insertions, 0 deletions
@@ -165,6 +165,76 @@ This file tracks prioritized tasks with detailed attack plans. - [ ] Centralize platform-specific code and `#ifdef`s into `platform.h` or equivalent. - [ ] Address `str_view()` calls that cause compilation breaks. +## Priority 1: Spectral Brush Editor (Task #5) [IN PROGRESS] + +**Goal:** Create a web-based tool for procedurally tracing audio spectrograms. Replaces large `.spec` binary assets with tiny procedural C++ code (50-100× compression). + +**Design Document:** See `doc/SPECTRAL_BRUSH_EDITOR.md` for complete architecture. + +**Core Concept: "Spectral Brush"** +- **Central Curve** (Bezier): Traces time-frequency path through spectrogram +- **Vertical Profile**: Shapes "brush stroke" around curve (Gaussian, Decaying Sinusoid, Noise) + +**Workflow:** +``` +.wav → Load in editor → Trace with Bezier curves → Export procedural_params.txt + C++ code +``` + +### Phase 1: C++ Runtime (Foundation) +- [ ] **Files:** `src/audio/spectral_brush.h`, `src/audio/spectral_brush.cc` +- [ ] Define API (`ProfileType`, `draw_bezier_curve()`, `evaluate_profile()`) +- [ ] Implement linear Bezier interpolation +- [ ] Implement Gaussian profile evaluation +- [ ] Implement home-brew deterministic RNG (for future noise support) +- [ ] Add unit tests (`src/tests/test_spectral_brush.cc`) +- [ ] **Deliverable:** Compiles, tests pass + +### Phase 2: Editor Core +- [ ] **Files:** `tools/spectral_editor/index.html`, `script.js`, `style.css`, `dct.js` (reuse from old editor) +- [ ] HTML structure (canvas, controls, file input) +- [ ] Canvas rendering (dual-layer: reference + procedural) +- [ ] Bezier curve editor (click to place, drag to adjust, delete control points) +- [ ] Profile controls (Gaussian sigma slider) +- [ ] Real-time spectrogram rendering +- [ ] Audio playback (IDCT → Web Audio API) +- [ ] Undo/Redo system (action history with snapshots) +- [ ] **Keyboard shortcuts:** + - Key '1': Play procedural sound + - Key '2': Play original .wav + - Space: Play/pause + - Ctrl+Z: Undo + - Ctrl+Shift+Z: Redo + - Delete: Remove control point +- [ ] **Deliverable:** Interactive editor, can trace .wav files + +### Phase 3: File I/O +- [ ] Load .wav (decode, FFT/STFT → spectrogram) +- [ ] Load .spec (binary format parser) +- [ ] Save procedural_params.txt (human-readable, re-editable) +- [ ] Generate C++ code (ready to compile) +- [ ] Load procedural_params.txt (re-editing workflow) +- [ ] **Deliverable:** Full save/load cycle works + +### Phase 4: Future Extensions (Post-MVP) +- [ ] Cubic Bezier interpolation (smoother curves) +- [ ] Decaying sinusoid profile (metallic sounds) +- [ ] Noise profile (textured sounds) +- [ ] Composite profiles (add/subtract/multiply) +- [ ] Multi-dimensional Bezier ({freq, amplitude, decay, ...}) +- [ ] Frequency snapping (snap to musical notes) +- [ ] Generic `gen_from_params()` code generation + +**Design Decisions:** +- Linear Bezier interpolation (Phase 1), cubic later +- Soft parameter limits in UI (not enforced) +- Home-brew RNG (small, deterministic) +- Single function per sound (generic loader later) +- Start with Bezier + Gaussian only + +**Size Impact:** 50-100× compression (5 KB .spec → ~100 bytes C++ code) + +--- + ## Priority 2: 3D System Enhancements (Task #18) **Goal:** Establish a pipeline for importing complex 3D scenes to replace hardcoded geometry. - [x] **Task #18.0: Basic OBJ Asset Pipeline** (New) |
