summaryrefslogtreecommitdiff
path: root/tools/mq_editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mq_editor')
-rw-r--r--tools/mq_editor/index.html10
-rw-r--r--tools/mq_editor/mq_synth.js4
2 files changed, 8 insertions, 6 deletions
diff --git a/tools/mq_editor/index.html b/tools/mq_editor/index.html
index 81b5bef..61ff1ac 100644
--- a/tools/mq_editor/index.html
+++ b/tools/mq_editor/index.html
@@ -348,6 +348,7 @@
<label><input type="checkbox" id="integratePhase" checked> Integrate phase</label>
<label><input type="checkbox" id="disableJitter"> Disable jitter</label>
<label><input type="checkbox" id="disableSpread"> Disable spread</label>
+ <label title="Test mode: force resonator synthesis for all partials (ignores per-partial mode setting)"><input type="checkbox" id="forceResonator"> Resonator (all)</label>
</div>
</div>
</div>
@@ -627,11 +628,12 @@
const partialsToUse = extractedPartials.slice(0, keepCount).filter(p => !p.muted);
setStatus(`Synthesizing ${partialsToUse.length}/${extractedPartials.length} partials (${keepPct.value}%)...`, 'info');
- const integratePhase = document.getElementById('integratePhase').checked;
- const disableJitter = document.getElementById('disableJitter').checked;
- const disableSpread = document.getElementById('disableSpread').checked;
+ const integratePhase = document.getElementById('integratePhase').checked;
+ const disableJitter = document.getElementById('disableJitter').checked;
+ const disableSpread = document.getElementById('disableSpread').checked;
+ const forceResonator = document.getElementById('forceResonator').checked;
const pcm = synthesizeMQ(partialsToUse, audioBuffer.sampleRate, audioBuffer.duration,
- integratePhase, {disableJitter, disableSpread});
+ integratePhase, {disableJitter, disableSpread, forceResonator});
if (viewer) {
viewer.setSynthStftCache(new STFTCache(pcm, audioBuffer.sampleRate, fftSize, parseInt(hopSize.value)));
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));