From f8f664964594a341884b2e9947f64feea4b925a6 Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 18 Feb 2026 10:51:25 +0100 Subject: feat(mq_editor): spread autodetection, 50% drop-off line, mini-spectrum peak fix - autodetectSpread(): measures half-power (-3dB) peak width in spectrogram to infer spread_above/below (replaces near-zero bezier residual approach) - 'Auto' button per partial + 'Auto Spread All' toolbar button - Spread panel inputs now trigger viewer refresh on change - 50% drop-off dotted reference lines on spread band (selected partial only) - Mini-spectrum: use max() instead of mean() over bins per pixel column, fixing high-frequency amplitude mismatch between original and synthesis handoff(Gemini): spread autodetection and mini-spectrum fixes done --- tools/mq_editor/index.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tools/mq_editor/index.html') 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 @@ + @@ -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(); }); -- cgit v1.2.3