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.html31
1 files changed, 21 insertions, 10 deletions
diff --git a/tools/mq_editor/index.html b/tools/mq_editor/index.html
index 84abd1c..27eba2a 100644
--- a/tools/mq_editor/index.html
+++ b/tools/mq_editor/index.html
@@ -82,7 +82,7 @@
<input type="number" id="hopSize" value="256" min="64" max="1024" step="64">
<label>Threshold (dB):</label>
- <input type="number" id="threshold" value="-60" min="-80" max="-20" step="5">
+ <input type="number" id="threshold" value="-60" step="any">
</div>
</div>
@@ -173,9 +173,8 @@
}
});
- // Extract partials
- extractBtn.addEventListener('click', () => {
- if (!audioBuffer) return;
+ function runExtraction() {
+ if (!stftCache) return;
setStatus('Extracting partials...', 'info');
extractBtn.disabled = true;
@@ -189,13 +188,12 @@
sampleRate: audioBuffer.sampleRate
};
- const partials = extractPartials(audioBuffer, params);
+ const result = extractPartials(params, stftCache);
- extractedPartials = partials;
- setStatus(`Extracted ${partials.length} partials`, 'info');
-
- // Update viewer
- viewer.setPartials(partials);
+ extractedPartials = result.partials;
+ viewer.setFrames(result.frames);
+ setStatus(`Extracted ${result.partials.length} partials`, 'info');
+ viewer.setPartials(result.partials);
} catch (err) {
setStatus('Extraction error: ' + err.message, 'error');
@@ -203,6 +201,16 @@
}
extractBtn.disabled = false;
}, 50);
+ }
+
+ // Extract partials
+ extractBtn.addEventListener('click', () => {
+ if (!audioBuffer) return;
+ runExtraction();
+ });
+
+ threshold.addEventListener('change', () => {
+ if (stftCache) runExtraction();
});
// Play audio
@@ -325,6 +333,9 @@
if (!playBtn.disabled) {
playBtn.click();
}
+ } else if (e.code === 'KeyP') {
+ e.preventDefault();
+ if (viewer) viewer.togglePeaks();
}
});
</script>