From f48397c58248ca338c258b1de762314926fe681f Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 18 Feb 2026 21:36:07 +0100 Subject: feat(mq_editor): movable inner bezier control points + clamp() refactor - P1/P2 in amp editor now draggable horizontally; t0 --- tools/mq_editor/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/mq_editor/app.js') diff --git a/tools/mq_editor/app.js b/tools/mq_editor/app.js index 9b05789..dd0a24f 100644 --- a/tools/mq_editor/app.js +++ b/tools/mq_editor/app.js @@ -4,13 +4,13 @@ function k1ToHz(k, sr) { if (k >= 1.0) return sr / 2; const cosW = (2 - 2*k - k*k) / (2*(1 - k)); - return Math.acos(Math.max(-1, Math.min(1, cosW))) * sr / (2 * Math.PI); + return Math.acos(clamp(cosW, -1, 1)) * sr / (2 * Math.PI); } // HP: y[n] = k*(y[n-1]+x[n]-x[n-1]) => -3dB from peak at cos(w) = 2k/(1+k²) function k2ToHz(k, sr) { if (k >= 1.0) return 0; const cosW = 2*k / (1 + k*k); - return Math.acos(Math.max(-1, Math.min(1, cosW))) * sr / (2 * Math.PI); + return Math.acos(clamp(cosW, -1, 1)) * sr / (2 * Math.PI); } function fmtHz(f) { return f >= 1000 ? (f/1000).toFixed(1) + 'k' : Math.round(f) + 'Hz'; -- cgit v1.2.3