summaryrefslogtreecommitdiff
path: root/tools/mq_editor/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mq_editor/index.html')
-rw-r--r--tools/mq_editor/index.html16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/mq_editor/index.html b/tools/mq_editor/index.html
index f6d052b..aab603b 100644
--- a/tools/mq_editor/index.html
+++ b/tools/mq_editor/index.html
@@ -261,6 +261,10 @@
<label>Threshold (dB):</label>
<input type="number" id="threshold" value="-20" step="any">
+ <label style="margin-left:16px;" title="Weight spectrum by frequency before peak detection (f * FFT_Power(f)), accentuates high-frequency peaks">
+ <input type="checkbox" id="freqWeight"> f·Power
+ </label>
+
<label style="margin-left:16px;">Keep:</label>
<input type="range" id="keepPct" min="1" max="100" value="100" style="width:100px; vertical-align:middle;">
<span id="keepPctLabel" style="margin-left:4px;">100%</span>
@@ -366,6 +370,7 @@
const hopSize = document.getElementById('hopSize');
const threshold = document.getElementById('threshold');
+ const freqWeightCb = document.getElementById('freqWeight');
const keepPct = document.getElementById('keepPct');
const keepPctLabel = document.getElementById('keepPctLabel');
const fftSize = 1024; // Fixed
@@ -483,6 +488,7 @@
fftSize: fftSize,
hopSize: parseInt(hopSize.value),
threshold: parseFloat(threshold.value),
+ freqWeight: freqWeightCb.checked,
sampleRate: audioBuffer.sampleRate
};
@@ -501,9 +507,7 @@
setStatus(`Extracted ${result.partials.length} partials`, 'info');
viewer.setPartials(result.partials);
viewer.setKeepCount(getKeepCount());
- // Refresh panels: re-select if index still valid, else clear
- const prevSel = viewer.selectedPartial;
- viewer.selectPartial(prevSel >= 0 && prevSel < result.partials.length ? prevSel : -1);
+ viewer.selectPartial(-1);
} catch (err) {
setStatus('Extraction error: ' + err.message, 'error');
@@ -531,6 +535,8 @@
p.replicas.spread_below = spread_below;
}
if (viewer) viewer.render();
+ const sel = viewer ? viewer.selectedPartial : -1;
+ if (sel >= 0) editor.onPartialSelect(sel);
setStatus(`Auto-spread applied to ${extractedPartials.length} partials`, 'info');
});
@@ -538,6 +544,10 @@
if (stftCache) runExtraction();
});
+ freqWeightCb.addEventListener('change', () => {
+ if (stftCache) runExtraction();
+ });
+
function playAudioBuffer(buffer, statusMsg) {
const startTime = audioContext.currentTime;
currentSource = audioContext.createBufferSource();