From 601eaebb935c6811b7bc4f62e05d6060ab4bc674 Mon Sep 17 00:00:00 2001 From: Aria Date: Sun, 16 Nov 2025 14:27:47 -0600 Subject: [PATCH] More cleanup --- packages/superdough/synth.mjs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index 8065aa4ee..9f3ab6cf2 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -45,25 +45,16 @@ export function registerSynthSounds() { 'linear', [0.001, 0.05, 0.6, 0.01], ); - - let sound = getOscillator(s, t, value); - let { node: o } = sound; - + const { node: o } = getOscillator(s, t, value); // turn down const g = gainNode(0.3); - - const { duration } = value; - const cleanup = () => { o.disconnect(); g.disconnect(); }; - - const envGain = gainNode(1); - let node = o.connect(g).connect(envGain); - const holdEnd = t + duration; + const node = o.connect(g).connect(gainNode(1)); + const holdEnd = t + value.duration; getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, t, holdEnd, 'linear'); - const envEnd = holdEnd + release + 0.01; return { node, cleanup, @@ -307,7 +298,6 @@ export function registerSynthSounds() { lfo = getLfo(ac, begin, end, { frequency: pwrate, depth: pwsweep }); lfo.connect(o.parameters.get('pulsewidth')); } - const cleanup = () => { destroyAudioWorkletNode(o); destroyAudioWorkletNode(lfo);