diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-18 05:11:12 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-18 05:11:12 +0100 |
| commit | 35ebfac6c860cc7de7db447b57158a7a3a27daaa (patch) | |
| tree | a94a5f670a3087b6d5e3a9048ee0c2a96c194129 /tools/mq_editor/mq_synth.js | |
| parent | e1f12a5a7eafbb5f4cc7b0da5f563850347fc84c (diff) | |
fix(mq_editor): Catmull-Rom bezier fit, NaN guard, synth FFT toggle
- evalBezier: guard dt<=0 to avoid NaN on degenerate curves
- fitBezier: replace nearest-neighbor control points with Catmull-Rom
tangents (Hermite->Bezier), curve now passes through endpoints
- key 'a': toggle mini-spectrum between original and synth FFT
handoff(Claude): bezier fix + synth FFT comparison
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, 3 insertions, 1 deletions
diff --git a/tools/mq_editor/mq_synth.js b/tools/mq_editor/mq_synth.js index f1c7f73..8dcb4bd 100644 --- a/tools/mq_editor/mq_synth.js +++ b/tools/mq_editor/mq_synth.js @@ -4,7 +4,9 @@ // Evaluate cubic bezier curve at time t function evalBezier(curve, t) { // Normalize t to [0, 1] - let u = (t - curve.t0) / (curve.t3 - curve.t0); + const dt = curve.t3 - curve.t0; + if (dt <= 0) return curve.v0; + let u = (t - curve.t0) / dt; u = Math.max(0, Math.min(1, u)); // Cubic interpolation |
