mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 13:38:40 +00:00
fix: exp envelope allow 0 without blowup
This commit is contained in:
parent
26d7a32f11
commit
876f97e9a2
@ -40,6 +40,8 @@ export const getEnvelope = (attack, decay, sustain, release, velocity, begin) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getExpEnvelope = (attack, decay, sustain, release, velocity, begin) => {
|
export const getExpEnvelope = (attack, decay, sustain, release, velocity, begin) => {
|
||||||
|
sustain = Math.max(0.001, sustain);
|
||||||
|
velocity = Math.max(0.001, velocity);
|
||||||
const gainNode = getAudioContext().createGain();
|
const gainNode = getAudioContext().createGain();
|
||||||
gainNode.gain.setValueAtTime(0.0001, begin);
|
gainNode.gain.setValueAtTime(0.0001, begin);
|
||||||
gainNode.gain.exponentialRampToValueAtTime(velocity, begin + attack);
|
gainNode.gain.exponentialRampToValueAtTime(velocity, begin + attack);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user