diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-06 16:59:07 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-06 16:59:07 +0100 |
| commit | a6ed45c4f56f6c4f27a778f6ce4a96d129feca11 (patch) | |
| tree | 6dc288b12ed30914007ea54eaa8b2cc2d778b71b /doc/SPECTRAL_BRUSH_EDITOR.md | |
| parent | f998bfcd7a6167ae6bdf5ad7f8685b2cdf1fe811 (diff) | |
docs: Milestone - FFT-based DCT/IDCT Complete (February 6, 2026)
## Summary
Completed full FFT-based DCT/IDCT implementation and integration, resolving
all audio synthesis issues. System now uses orthonormal DCT-II/DCT-III with
Numerical Recipes reordering method.
## Technical Achievements
### Core Implementation (commits 700209d, d9e0da9)
- Replaced failing double-and-mirror method with reordering method
- Fixed reference IDCT to use DCT-III (inverse of DCT-II, not IDCT-II)
- Integrated FFT-based transforms into audio engine and both web editors
- All transforms use orthonormal normalization: sqrt(1/N) for DC, sqrt(2/N) for AC
### Audio Pipeline Fixes
1. **Normalization Mismatch** (commit 2ffb7c3): Regenerated all spectrograms
with orthonormal DCT to match new synthesis engine
2. **Procedural Notes** (commit a9f0174): Added 16x scaling compensation
(sqrt(DCT_SIZE/2)) for NOTE_* generation to restore correct volume
3. **Windowing Error** (commits 6ed5952, f998bfc): Removed incorrect Hamming
window application before IDCT (window only for analysis, not synthesis)
## Verification
- All 23 tests passing (100% success rate)
- Round-trip accuracy verified (impulse at index 0: perfect)
- Sinusoidal inputs: <5e-3 error (acceptable for FFT)
- Audio playback: correct volume, no distortion
- Procedural notes: audible at correct levels
- Web editors: clean spectrum, no comb artifacts
## Files Modified
- src/audio/fft.cc: Reordering method implementation
- src/audio/idct.cc, fdct.cc: FFT wrappers
- src/audio/gen.cc: 16x scaling for procedural generation
- src/audio/synth.cc: Removed incorrect windowing
- src/tests/test_fft.cc: Fixed reference IDCT, updated tolerances
- tools/spectral_editor/dct.js, script.js: JavaScript FFT implementation
- tools/editor/dct.js, script.js: Matching windowing fixes
## Key Insights
1. DCT-III is inverse of DCT-II, not IDCT-II
2. Hamming window is ONLY for analysis (before DCT), NOT synthesis (before IDCT)
3. Orthonormal DCT produces sqrt(N/2) smaller values than non-orthonormal
4. Reordering method is more accurate than double-and-mirror for DCT via FFT
handoff(Claude): FFT-based DCT/IDCT implementation complete and verified.
Audio synthesis pipeline fully corrected. All tests passing.
Diffstat (limited to 'doc/SPECTRAL_BRUSH_EDITOR.md')
0 files changed, 0 insertions, 0 deletions
