mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 13:38:40 +00:00
i have no clue why this works
This commit is contained in:
parent
6f3b2fa66b
commit
4fb5c1828d
@ -37,13 +37,14 @@ export const getParamADSR = (
|
|||||||
min = Math.max(0.0001, min);
|
min = Math.max(0.0001, min);
|
||||||
}
|
}
|
||||||
const range = max - min;
|
const range = max - min;
|
||||||
const peak = min + range;
|
const peak = max;
|
||||||
const sustainVal = min + sustain * range;
|
const sustainVal = min + sustain * range;
|
||||||
const duration = end - begin;
|
const duration = end - begin;
|
||||||
|
|
||||||
const envValAtTime = (time) => {
|
const envValAtTime = (time) => {
|
||||||
if (attack > time) {
|
if (attack > time) {
|
||||||
return time * getSlope(min, peak, 0, attack) + 0;
|
let slope = getSlope(min, peak, 0, attack);
|
||||||
|
return time * slope + (min > peak ? min : 0);
|
||||||
} else {
|
} else {
|
||||||
return (time - attack) * getSlope(peak, sustainVal, 0, decay) + peak;
|
return (time - attack) * getSlope(peak, sustainVal, 0, decay) + peak;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user