summaryrefslogtreecommitdiff
path: root/tools/mq_editor/mq_extract.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mq_editor/mq_extract.js')
-rw-r--r--tools/mq_editor/mq_extract.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/mq_editor/mq_extract.js b/tools/mq_editor/mq_extract.js
index 18897fb..42215d3 100644
--- a/tools/mq_editor/mq_extract.js
+++ b/tools/mq_editor/mq_extract.js
@@ -451,7 +451,7 @@ function trackIsoContour(stftCache, seedTime, seedFreq, params) {
}
const seedFrame = stftCache.getFrameAtIndex(seedFrameIdx);
- const seedBin = Math.max(1, Math.min(halfBins - 2, Math.round(seedFreq / binHz)));
+ const seedBin = clamp(Math.round(seedFreq / binHz), 1, halfBins - 2);
const targetSq = seedFrame.squaredAmplitude[seedBin];
if (targetSq <= 0) return null;
const targetDB = 10 * Math.log10(targetSq);