summaryrefslogtreecommitdiff
path: root/tools/mq_editor/editor.js
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-19 00:00:06 +0100
committerskal <pascal.massimino@gmail.com>2026-02-19 00:00:06 +0100
commitdb5c023acd237d7015933bd21a5a6dbe5755841d (patch)
tree219ca50b1728a57f3a5e6ba0e0640b0f0739f93b /tools/mq_editor/editor.js
parent618bd1dc9af4beb98584ed817772951007017f79 (diff)
fix(mq_editor): fuse spread_above/below into single spread param
Asymmetric spread offset the pitch center. Replace with a single symmetric `spread` in harmonics config. autodetectSpread now returns max(above, below). Update all defaults, UI, comments, and README. handoff(Gemini): spread is now a single param; no compat shims. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'tools/mq_editor/editor.js')
-rw-r--r--tools/mq_editor/editor.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/tools/mq_editor/editor.js b/tools/mq_editor/editor.js
index b07664e..98c92e5 100644
--- a/tools/mq_editor/editor.js
+++ b/tools/mq_editor/editor.js
@@ -124,7 +124,7 @@ class PartialEditor {
const grid = this._synthGrid;
grid.innerHTML = '';
- const harmDefaults = { decay: 0.0, freq_mult: 2.0, jitter: 0.05, spread_above: 0.02, spread_below: 0.02 };
+ const harmDefaults = { decay: 0.0, freq_mult: 2.0, jitter: 0.05, spread: 0.02 };
const resDefaults = { r: 0.995, gainComp: 1.0 };
const isResonator = !!(partial.resonator && partial.resonator.enabled);
@@ -158,11 +158,10 @@ class PartialEditor {
const harm = partial.harmonics || {};
const sinParams = [
- { key: 'decay', label: 'h.decay', step: '0.01', max: '0.90' },
- { key: 'freq_mult', label: 'h.freq', step: '0.01' },
- { key: 'jitter', label: 'jitter', step: '0.001' },
- { key: 'spread_above', label: 'spread ↑', step: '0.001' },
- { key: 'spread_below', label: 'spread ↓', step: '0.001' },
+ { key: 'decay', label: 'h.decay', step: '0.01', max: '0.90' },
+ { key: 'freq_mult', label: 'h.freq', step: '0.01' },
+ { key: 'jitter', label: 'jitter', step: '0.001' },
+ { key: 'spread', label: 'spread', step: '0.001' },
];
const sinInputs = {};
for (const p of sinParams) {
@@ -206,22 +205,20 @@ class PartialEditor {
// Auto-detect spread button
const autoLbl = document.createElement('span');
- autoLbl.textContent = 'spread';
+ autoLbl.textContent = '';
const autoBtn = document.createElement('button');
- autoBtn.textContent = 'Auto';
- autoBtn.title = 'Infer spread_above/below from frequency variance around the bezier curve';
+ autoBtn.textContent = 'Auto spread';
+ autoBtn.title = 'Infer spread from half-power bandwidth around the bezier curve';
autoBtn.addEventListener('click', () => {
if (!this.partials) return;
const p = this.partials[index];
const sc = this.viewer ? this.viewer.stftCache : null;
const sr = this.viewer ? this.viewer.audioBuffer.sampleRate : 44100;
const fs = sc ? sc.fftSize : 2048;
- const {spread_above, spread_below} = autodetectSpread(p, sc, fs, sr);
+ const {spread} = autodetectSpread(p, sc, fs, sr);
if (!p.harmonics) p.harmonics = { ...harmDefaults };
- p.harmonics.spread_above = spread_above;
- p.harmonics.spread_below = spread_below;
- sinInputs['spread_above'].value = spread_above.toFixed(4);
- sinInputs['spread_below'].value = spread_below.toFixed(4);
+ p.harmonics.spread = spread;
+ sinInputs['spread'].value = spread.toFixed(4);
});
sinSection.appendChild(autoLbl);
sinSection.appendChild(autoBtn);