diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-18 11:57:57 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-18 11:57:57 +0100 |
| commit | e438df22d88b42f98571a4a85d33ed2b705945b1 (patch) | |
| tree | 6ebad386706dfdf8b751b0955c0f6e2443450d91 /tools/mq_editor/mq_synth.js | |
| parent | 722b545e79178ae67b11af6a3567e68c69fd1983 (diff) | |
feat(mq_editor): global resonator test-mode checkbox in Synthesis panel
Adds "Resonator (all)" checkbox that forces resonator synthesis for all
partials without modifying per-partial mode settings.
Fixes null deref when partial.resonator is undefined in forceResonator mode.
handoff(Gemini): resonator test-mode checkbox added; no per-partial data mutated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'tools/mq_editor/mq_synth.js')
| -rw-r--r-- | tools/mq_editor/mq_synth.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/mq_editor/mq_synth.js b/tools/mq_editor/mq_synth.js index f298392..d85c890 100644 --- a/tools/mq_editor/mq_synth.js +++ b/tools/mq_editor/mq_synth.js @@ -50,12 +50,12 @@ function synthesizeMQ(partials, sampleRate, duration, integratePhase = true, opt const fc = partial.freqCurve; const ac = partial.ampCurve; - if (partial.resonator && partial.resonator.enabled) { + if ((partial.resonator && partial.resonator.enabled) || options.forceResonator) { // --- Two-pole resonator mode --- // Driven by band-limited noise scaled by amp curve. // r controls pole radius (bandwidth): r→1 = narrow, r→0 = wide. // gainNorm = sqrt(1 - r²) normalises steady-state output power to ~A. - const res = partial.resonator; + const res = partial.resonator || {}; const r = res.r != null ? Math.min(0.9999, Math.max(0, res.r)) : 0.995; const gainComp = res.gainComp != null ? res.gainComp : 1.0; const gainNorm = Math.sqrt(Math.max(0, 1.0 - r * r)); |
