Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Dec 12, 2023
1 parent b0bbd58 commit f38d1c2
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/superdough/helpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
};
};
Expand Down

0 comments on commit f38d1c2

Please sign in to comment.