From cf845ddbab3da24ea23bb83ec90af15d513bba95 Mon Sep 17 00:00:00 2001 From: Aria Date: Thu, 12 Feb 2026 18:30:50 -0600 Subject: [PATCH 1/2] Fix typo in phase computation --- packages/superdough/synth.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index 38ad643de..224936914 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -485,8 +485,10 @@ export function waveformN(partials, phases, type) { if (phase !== 0) { const c = Math.cos(PI2 * phase); const s = Math.sin(PI2 * phase); - R = c * R - s * I; - I = s * R + c * I; + const R0 = R; + const I0 = I; + R = c * R0 - s * I0; + I = s * R0 + c * I0; } real[n + 1] = R; imag[n + 1] = I; From e15ce7d402af1e856088b3e37b813c0d0f6bfc15 Mon Sep 17 00:00:00 2001 From: Aria Date: Sat, 14 Mar 2026 14:48:57 -0500 Subject: [PATCH 2/2] Add replace and insert code helpers to codemirror --- packages/codemirror/codemirror.mjs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/codemirror/codemirror.mjs b/packages/codemirror/codemirror.mjs index 6aac0c8a4..71e5c49ab 100644 --- a/packages/codemirror/codemirror.mjs +++ b/packages/codemirror/codemirror.mjs @@ -444,14 +444,16 @@ export class StrudelMirror { this.setFontSize(value); } } - setCode(code) { - const changes = { - from: 0, - to: this.editor.state.doc.length, - insert: code, - }; + replaceCode(code, from, to) { + const changes = { from, to, insert: code }; this.editor.dispatch({ changes }); } + insertCode(code, position) { + this.replaceCode(code, position, position); + } + setCode(code) { + this.replaceCode(code, 0, this.editor.state.doc.length); + } // used for debugging but could serve other purposes getActiveWidgets() { return getActiveWidgets(this.editor);