From d65b908bda4784975ae8cc57f23562a68798dc2a Mon Sep 17 00:00:00 2001 From: Aria Date: Tue, 25 Nov 2025 17:27:37 -0600 Subject: [PATCH 1/3] Disconnect lfos for phaser and filters --- packages/superdough/helpers.mjs | 5 +++-- packages/superdough/superdough.mjs | 35 ++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index baa4db25e..ed2c0c448 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -240,6 +240,7 @@ export function createFilter(context, start, end, params, cps, cycle) { rate = cps * sync; } const hasLFO = [depth, depthfrequency, skew, shape, rate].some((v) => v !== undefined); + let lfo; if (hasLFO) { depth = depth ?? 1; const time = cycle / cps; @@ -255,10 +256,10 @@ export function createFilter(context, start, end, params, cps, cycle) { time, curve: 1, }; - getParamLfo(context, frequencyParam, start, end, lfoValues); + lfo = getParamLfo(context, frequencyParam, start, end, lfoValues); } - return filter; + return { filter, lfo }; } // stays 1 until .5, then fades out diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 0db41c088..110f2b31d 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -287,7 +287,7 @@ export function connectToDestination(input, channels) { function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000, sweep = 2000) { const ac = getAudioContext(); - const lfoGain = getLfo(ac, time, end, { frequency, depth: sweep * 2 }); + const lfo = getLfo(ac, time, end, { frequency, depth: sweep * 2 }); //filters const numStages = 2; //num of filters in series @@ -300,14 +300,14 @@ function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000 filter.frequency.value = centerFrequency + fOffset; filter.Q.value = 2 - Math.min(Math.max(depth * 2, 0), 1.9); - lfoGain.connect(filter.detune); + lfo.connect(filter.detune); fOffset += 282; if (i > 0) { filterChain[i - 1].connect(filter); } filterChain.push(filter); } - return filterChain[filterChain.length - 1]; + return { filter: filterChain[filterChain.length - 1], lfo }; } function getFilterType(ftype) { @@ -561,9 +561,13 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) const lpParams = pickAndRename(value, lpMap); lpParams.type = 'lowpass'; let lp = () => createFilter(ac, t, end, lpParams, cps, cycle); - chain.push(lp()); + const { filter: lpf1, lfo: lfo1 } = lp(); + chain.push(lpf1); + lfo1 && audioNodes.push(lfo1); if (ftype === '24db') { - chain.push(lp()); + const { filter: lpf2, lfo: lfo2 } = lp(); + chain.push(lpf2); + lfo2 && audioNodes.push(lfo2); } } @@ -590,9 +594,13 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) const hpParams = pickAndRename(value, hpMap); hpParams.type = 'highpass'; let hp = () => createFilter(ac, t, end, hpParams, cps, cycle); - chain.push(hp()); + const { filter: hpf1, lfo: lfo1 } = hp(); + chain.push(hpf1); + lfo1 && audioNodes.push(lfo1) if (ftype === '24db') { - chain.push(hp()); + const { filter: hpf2, lfo: lfo2 } = hp(); + chain.push(hpf2); + lfo2 && audioNodes.push(lfo2) } } @@ -619,9 +627,13 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) const bpParams = pickAndRename(value, bpMap); bpParams.type = 'bandpass'; let bp = () => createFilter(ac, t, end, bpParams, cps, cycle); - chain.push(bp()); + const { filter: bpf1, lfo: lfo1 } = bp(); + chain.push(bpf1); + lfo1 && audioNodes.push(lfo1) if (ftype === '24db') { - chain.push(bp()); + const { filter: bpf2, lfo: lfo2 } = hp(); + chain.push(bpf2); + lfo2 && audioNodes.push(lfo2) } } @@ -685,8 +697,9 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) } // phaser if (phaser !== undefined && phaserdepth > 0) { - const phaserFX = getPhaser(t, endWithRelease, phaser, phaserdepth, phasercenter, phasersweep); - chain.push(phaserFX); + const { phaser, lfo } = getPhaser(t, endWithRelease, phaser, phaserdepth, phasercenter, phasersweep); + audioNodes.push(lfo); + chain.push(phaser); } // last gain From 692359309f211cda7b5dd26a6cd20c208a6090b7 Mon Sep 17 00:00:00 2001 From: Aria Date: Tue, 25 Nov 2025 17:31:11 -0600 Subject: [PATCH 2/3] Typo and formatting --- packages/superdough/superdough.mjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 110f2b31d..5a8b72806 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -596,11 +596,11 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) let hp = () => createFilter(ac, t, end, hpParams, cps, cycle); const { filter: hpf1, lfo: lfo1 } = hp(); chain.push(hpf1); - lfo1 && audioNodes.push(lfo1) + lfo1 && audioNodes.push(lfo1); if (ftype === '24db') { const { filter: hpf2, lfo: lfo2 } = hp(); chain.push(hpf2); - lfo2 && audioNodes.push(lfo2) + lfo2 && audioNodes.push(lfo2); } } @@ -629,11 +629,11 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) let bp = () => createFilter(ac, t, end, bpParams, cps, cycle); const { filter: bpf1, lfo: lfo1 } = bp(); chain.push(bpf1); - lfo1 && audioNodes.push(lfo1) + lfo1 && audioNodes.push(lfo1); if (ftype === '24db') { - const { filter: bpf2, lfo: lfo2 } = hp(); + const { filter: bpf2, lfo: lfo2 } = bp(); chain.push(bpf2); - lfo2 && audioNodes.push(lfo2) + lfo2 && audioNodes.push(lfo2); } } From 18dc4944bffff559fe686395eb487731088ed2e5 Mon Sep 17 00:00:00 2001 From: Aria Date: Fri, 28 Nov 2025 12:36:23 -0600 Subject: [PATCH 3/3] Typos and cleanup --- packages/superdough/superdough.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 5a8b72806..f54689acb 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -307,7 +307,7 @@ function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000 } filterChain.push(filter); } - return { filter: filterChain[filterChain.length - 1], lfo }; + return { phaser: filterChain[filterChain.length - 1], lfo }; } function getFilterType(ftype) { @@ -413,7 +413,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) release = 0, //phaser - phaserrate: phaser, + phaserrate, phaserdepth = getDefaultValue('phaserdepth'), phasersweep, phasercenter, @@ -560,7 +560,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) }; const lpParams = pickAndRename(value, lpMap); lpParams.type = 'lowpass'; - let lp = () => createFilter(ac, t, end, lpParams, cps, cycle); + const lp = () => createFilter(ac, t, end, lpParams, cps, cycle); const { filter: lpf1, lfo: lfo1 } = lp(); chain.push(lpf1); lfo1 && audioNodes.push(lfo1); @@ -593,7 +593,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) }; const hpParams = pickAndRename(value, hpMap); hpParams.type = 'highpass'; - let hp = () => createFilter(ac, t, end, hpParams, cps, cycle); + const hp = () => createFilter(ac, t, end, hpParams, cps, cycle); const { filter: hpf1, lfo: lfo1 } = hp(); chain.push(hpf1); lfo1 && audioNodes.push(lfo1); @@ -626,7 +626,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) }; const bpParams = pickAndRename(value, bpMap); bpParams.type = 'bandpass'; - let bp = () => createFilter(ac, t, end, bpParams, cps, cycle); + const bp = () => createFilter(ac, t, end, bpParams, cps, cycle); const { filter: bpf1, lfo: lfo1 } = bp(); chain.push(bpf1); lfo1 && audioNodes.push(lfo1); @@ -696,8 +696,8 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) chain.push(panner); } // phaser - if (phaser !== undefined && phaserdepth > 0) { - const { phaser, lfo } = getPhaser(t, endWithRelease, phaser, phaserdepth, phasercenter, phasersweep); + if (phaserrate !== undefined && phaserdepth > 0) { + const { phaser, lfo } = getPhaser(t, endWithRelease, phaserrate, phaserdepth, phasercenter, phasersweep); audioNodes.push(lfo); chain.push(phaser); }