replace odd envelope

This commit is contained in:
Raphael Forment 2023-09-04 21:24:42 +02:00
parent 5be7898522
commit 4319df0cb6

View File

@ -74,11 +74,8 @@ export function createFilter(context, type, frequency, Q, attack, decay, sustain
// Apply ADSR to filter frequency
if (fenvmod > 0) {
const sustainFreq = sustain * frequency;
filter.frequency.linearRampToValueAtTime(frequency * fenvmod, t + attack);
filter.frequency.linearRampToValueAtTime(sustainFreq, t + attack + decay);
filter.frequency.setValueAtTime(sustainFreq, end);
filter.frequency.linearRampToValueAtTime(frequency, end + release);
const gainNode = getADSR(attack, decay, sustain, release, fenvmod, t, t + attack + decay + release);
gainNode.connect(filter.frequency);
}
return filter;