diff options
Diffstat (limited to 'tools/mq_editor/README.md')
| -rw-r--r-- | tools/mq_editor/README.md | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tools/mq_editor/README.md b/tools/mq_editor/README.md index d79a2f8..3827d4f 100644 --- a/tools/mq_editor/README.md +++ b/tools/mq_editor/README.md @@ -8,9 +8,9 @@ McAulay-Quatieri sinusoidal analysis and synthesis tool. open tools/mq_editor/index.html ``` -1. Click **Open WAV** (or **⚗ Test WAV** for a built-in 440+660 Hz test signal) +1. Click **Open WAV** 2. Click **Extract Partials** (optional — Explore/Contour modes work immediately after load) -3. Press **1** to play synthesized, **2** to play original +3. Press **1** to play original, **2** to play synthesized, **3** to play current partial ## UI @@ -86,8 +86,8 @@ Committed partials are prepended to the partial list with full undo support. | Key | Action | |-----|--------| -| `1` | Play synthesized audio | -| `2` | Play original audio | +| `1` | Play original audio | +| `2` | Play synthesized audio | | `3` | Play selected partial alone | | `E` | Extract Partials | | `N` | New partial (flat 440 Hz, full duration) | @@ -95,6 +95,7 @@ Committed partials are prepended to the partial list with full undo support. | `C` | Toggle ≋ Contour mode (iso-energy tracking) | | `P` | Toggle raw peak overlay | | `A` | Toggle mini-spectrum: original ↔ synthesized | +| `Delete` | Delete selected partial | | `Esc` | Exit explore/contour mode · deselect partial | | `Ctrl+Z` | Undo | | `Ctrl+Y` / `Ctrl+Shift+Z` | Redo | @@ -104,10 +105,12 @@ Committed partials are prepended to the partial list with full undo support. ## Architecture - `index.html` — UI, playback, extraction orchestration, keyboard shortcuts +- `style.css` — All UI styles (extracted from inline styles) - `editor.js` — Property panel and amplitude bezier editor for selected partials - `fft.js` — Cooley-Tukey radix-2 FFT + STFT cache - `mq_extract.js` — MQ algorithm: peak detection, forward tracking, backward expansion, bezier fitting - `mq_synth.js` — Oscillator bank + two-pole resonator synthesis from extracted partials +- `utils.js` — Shared helpers: `evalBezier`, `evalBezierAmp`, `clamp`, canvas coordinate utilities - `viewer.js` — Visualization: coordinate API, spectrogram, partials, mini-spectrum, mouse/zoom ### viewer.js coordinate API @@ -123,6 +126,19 @@ Committed partials are prepended to the partial list with full undo support. | `normalizeDB(db, maxDB)` | dB → intensity [0..1] over 80 dB range | | `partialColor(p)` | partial index → display color | +## Amplitude Bezier Editor + +The bottom panel shows the amplitude envelope for the selected partial as a **Lagrange interpolating curve** through four control points P0–P3. + +- **P0, P3** (endpoints): drag vertically to adjust amplitude at the start/end of the partial. Time positions are fixed to `t_start`/`t_end`. +- **P1, P2** (inner points): drag in **both axes** — vertically for amplitude, horizontally for time position. The ordering constraint `t0 < t1 < t2 < t3` is enforced automatically. + +Cursor hints: `ns-resize` for P0/P3, `move` for P1/P2. + +All four time and amplitude values are also editable as numbers in the property panel above. + +--- + ## Post-Synthesis Filters Global LP/HP filters applied after the oscillator bank, before normalization. @@ -164,7 +180,7 @@ y[n] = 2r·cos(ω₀)·y[n-1] − r²·y[n-2] + A(t)·√(1−r²)·noise[n] | `gain` | 1.0 | [0, ∞) | Output multiplier on top of power normalization. | **Coefficient translation from spread:** -`r = exp(−π · BW / SR)` where `BW = f₀ · (spread_above + spread_below) / 2`. +`r = exp(−π · BW / SR)` where `BW = f₀ · spread`. For a partial at 440 Hz with `spread = 0.02`: `BW ≈ 8.8 Hz`, `r ≈ exp(−π·8.8/32000) ≈ 0.9991`. **When to use:** @@ -200,7 +216,7 @@ For a partial at 440 Hz with `spread = 0.02`: `BW ≈ 8.8 Hz`, `r ≈ exp(−π - [x] Synthesized STFT cache for FFT comparison - [x] Phase 3: Editing UI - [x] Partial selection with property panel (freq/amp/synth tabs) - - [x] Amplitude bezier drag editor + - [x] Amplitude bezier drag editor (P1/P2 horizontally movable, ordering constrained) - [x] Synth params with jog sliders (decay, jitter, spread) - [x] Auto-spread detection per partial and global - [x] Mute / delete partials |
