diff --git a/packages/superdough/helpers.mjs b/packages/superdough/helpers.mjs index 9833a90f..9194e2bb 100644 --- a/packages/superdough/helpers.mjs +++ b/packages/superdough/helpers.mjs @@ -22,18 +22,12 @@ export const getEnvelope = (attack, decay, sustain, release, velocity, begin) => node: gainNode, stop: (t) => { // to make sure the release won't begin before sustain is reached - //phase = Math.max(t, phase + 0.001); phase = Math.max(t, phase); // see https://github.com/tidalcycles/strudel/issues/522 - //if (typeof gainNode.gain.cancelAndHoldAtTime === 'function') { - // gainNode.gain.cancelAndHoldAtTime(t); // this seems to release instantly.... - // see https://discord.com/channels/779427371270275082/937365093082079272/1086053607360712735 - //} else { - // firefox: this will glitch when the sustain has not been reached yet at the time of release gainNode.gain.setValueAtTime(sustainLevel, phase); - //} - gainNode.gain.linearRampToValueAtTime(0, phase + release); // release - return phase + release; + phase += release; + gainNode.gain.linearRampToValueAtTime(0, phase); // release + return phase; }, }; };