mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-13 06:38:29 +00:00
negative fenv values now stay in the same range as positives
This commit is contained in:
parent
f17459fdc3
commit
6f3b2fa66b
@ -111,9 +111,11 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe
|
||||
if (hasEnvelope !== undefined) {
|
||||
fenv = nanFallback(fenv, 1, true);
|
||||
fanchor = nanFallback(fanchor, 0, true);
|
||||
const offset = fenv * fanchor;
|
||||
const min = clamp(2 ** -offset * frequency, 0, 20000);
|
||||
const max = clamp(2 ** (fenv - offset) * frequency, 0, 20000);
|
||||
const fenvAbs = Math.abs(fenv);
|
||||
const offset = fenvAbs * fanchor;
|
||||
let min = clamp(2 ** -offset * frequency, 0, 20000);
|
||||
let max = clamp(2 ** (fenvAbs - offset) * frequency, 0, 20000);
|
||||
if (fenv < 0) [min, max] = [max, min];
|
||||
getParamADSR(filter.frequency, attack, decay, sustain, release, min, max, start, end, curve);
|
||||
return filter;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user