use fenv to scale above base cutoff?
This commit is contained in:
parent
9e4c548c69
commit
606dcc8cc3
1 changed files with 9 additions and 7 deletions
|
|
@ -66,12 +66,13 @@ export const getADSR = (attack, decay, sustain, release, velocity, begin, end) =
|
||||||
return gainNode;
|
return gainNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getParamADSR = (param, attack, decay, sustain, release, max, begin, end) => {
|
export const getParamADSR = (param, attack, decay, sustain, release, min, max, begin, end) => {
|
||||||
param.setValueAtTime(0, begin);
|
const range = max - min;
|
||||||
param.linearRampToValueAtTime(max, begin + attack);
|
param.setValueAtTime(min, begin);
|
||||||
param.linearRampToValueAtTime(sustain * max, begin + attack + decay);
|
param.linearRampToValueAtTime(min + range, begin + attack);
|
||||||
param.setValueAtTime(sustain * max, end);
|
param.linearRampToValueAtTime(min + sustain * range, begin + attack + decay);
|
||||||
param.linearRampToValueAtTime(0, end + release);
|
param.setValueAtTime(min + sustain * range, end);
|
||||||
|
param.linearRampToValueAtTime(min, end + release);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createFilter(context, type, frequency, Q, attack, decay, sustain, release, fenv, start, end) {
|
export function createFilter(context, type, frequency, Q, attack, decay, sustain, release, fenv, start, end) {
|
||||||
|
|
@ -87,7 +88,8 @@ export function createFilter(context, type, frequency, Q, attack, decay, sustain
|
||||||
decay,
|
decay,
|
||||||
sustain,
|
sustain,
|
||||||
release,
|
release,
|
||||||
Math.min(frequency * fenv, 20000),
|
frequency,
|
||||||
|
Math.min(frequency + 200 * 2 ** fenv, 20000),
|
||||||
start,
|
start,
|
||||||
end + release,
|
end + release,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue