diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-18 06:59:32 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-18 06:59:32 +0100 |
| commit | 105c817021a84bfacffa1553d6bcd536808b9f23 (patch) | |
| tree | 36bc576d4605c5057e1604640f0fa1679866d6b6 /tools/mq_editor/mq_synth.js | |
| parent | 65cd99553cd688c5ad2cfd64d79c6434fe694a33 (diff) | |
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
Diffstat (limited to 'tools/mq_editor/mq_synth.js')
| -rw-r--r-- | tools/mq_editor/mq_synth.js | 9 |
1 files changed, 6 insertions, 3 deletions
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}); } |
