fix: exp envelope allow 0 without blowup
This commit is contained in:
parent
26d7a32f11
commit
876f97e9a2
1 changed files with 2 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue