diff options
Diffstat (limited to 'tools/mq_editor/editor.js')
| -rw-r--r-- | tools/mq_editor/editor.js | 25 |
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); |
