From 105c817021a84bfacffa1553d6bcd536808b9f23 Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 18 Feb 2026 06:59:32 +0100 Subject: feat(mq_editor): UI improvements and partial detection enhancements - Right panel with synthesis checkboxes (integrate phase, disable jitter, disable spread) - Style file chooser as button; show filename next to page title - Second backward pass in extractPartials to recover partial onsets - Cursor line drawn on overlay canvas (no full redraw on mousemove) handoff(Claude): UI + algo improvements complete --- tools/mq_editor/mq_synth.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tools/mq_editor/mq_synth.js') diff --git a/tools/mq_editor/mq_synth.js b/tools/mq_editor/mq_synth.js index 6fa2a09..1eec709 100644 --- a/tools/mq_editor/mq_synth.js +++ b/tools/mq_editor/mq_synth.js @@ -25,10 +25,13 @@ function randFloat(seed, min, max) { // replicas: {offsets, decay_alpha, jitter, spread_above, spread_below} // integratePhase: true = accumulate 2π*f/SR per sample (correct for varying freq) // false = 2π*f*t (simpler, only correct for constant freq) -function synthesizeMQ(partials, sampleRate, duration, integratePhase = true) { +function synthesizeMQ(partials, sampleRate, duration, integratePhase = true, options = {}) { const numSamples = Math.floor(sampleRate * duration); const pcm = new Float32Array(numSamples); + const jitterMult = options.disableJitter ? 0 : 1; + const spreadMult = options.disableSpread ? 0 : 1; + const defaultReplicas = { offsets: [1.0], decay_alpha: 0.1, @@ -50,8 +53,8 @@ function synthesizeMQ(partials, sampleRate, duration, integratePhase = true) { const replicaData = []; for (let r = 0; r < offsets.length; ++r) { // Fixed per-replica spread (frequency detuning) and initial phase (jitter) - const spread = randFloat(p * 67890 + r * 999, -spread_below, spread_above); - const initPhase = randFloat(p * 67890 + r, 0.0, 1.0) * jitter * 2.0 * Math.PI; + const spread = spreadMult * randFloat(p * 67890 + r * 999, -spread_below, spread_above); + const initPhase = randFloat(p * 67890 + r, 0.0, 1.0) * (jitter * jitterMult) * 2.0 * Math.PI; replicaData.push({ratio: offsets[r], spread, phase: initPhase}); } -- cgit v1.2.3