diff options
Diffstat (limited to 'tools/mq_editor/index.html')
| -rw-r--r-- | tools/mq_editor/index.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/mq_editor/index.html b/tools/mq_editor/index.html index 8f36314..5e1e5c4 100644 --- a/tools/mq_editor/index.html +++ b/tools/mq_editor/index.html @@ -212,6 +212,7 @@ <button id="chooseFileBtn">📂 Open WAV</button> <button id="testWavBtn">⚗ Test WAV</button> <button id="extractBtn" disabled>Extract Partials</button> + <button id="autoSpreadAllBtn" disabled>Auto Spread All</button> <button id="playBtn" disabled>▶ Play</button> <button id="stopBtn" disabled>■ Stop</button> @@ -464,6 +465,7 @@ console.error(err); } extractBtn.disabled = false; + autoSpreadAllBtn.disabled = false; }, 50); } @@ -473,6 +475,23 @@ runExtraction(); }); + // Auto-spread all partials + const autoSpreadAllBtn = document.getElementById('autoSpreadAllBtn'); + autoSpreadAllBtn.addEventListener('click', () => { + if (!extractedPartials || !stftCache) return; + const fs = stftCache.fftSize; + const sr = audioBuffer.sampleRate; + const defaults = { decay_alpha: 0.1, jitter: 0.05, spread_above: 0.02, spread_below: 0.02 }; + for (const p of extractedPartials) { + const {spread_above, spread_below} = autodetectSpread(p, stftCache, fs, sr); + if (!p.replicas) p.replicas = { ...defaults }; + p.replicas.spread_above = spread_above; + p.replicas.spread_below = spread_below; + } + if (viewer) viewer.render(); + setStatus(`Auto-spread applied to ${extractedPartials.length} partials`, 'info'); + }); + threshold.addEventListener('change', () => { if (stftCache) runExtraction(); }); |
