This commit is contained in:
Jade (Rose) Rowland 2025-11-22 23:42:20 -05:00
parent 30e672a027
commit 7bbb653963
2 changed files with 20 additions and 15 deletions

View file

@ -191,9 +191,6 @@ export function applyParameterModulators(audioContext, param, start, end, envelo
const lfo = getParamLfo(audioContext, param, start, end, lfoValues);
return { lfo, disconnect: () => lfo?.disconnect() };
}
function biloparExponential(x, k) {
return Math.sign(x) * 2 ** (Math.abs(x) * k);
}
export function createFilter(context, start, end, params, cps, cycle) {
let {
frequency,
@ -233,7 +230,6 @@ export function createFilter(context, start, end, params, cps, cycle) {
const offset = envAbs * anchor;
let min = clamp(2 ** -offset * frequency, 0, 20000);
let max = clamp(2 ** (envAbs - offset) * frequency, 0, 20000);
if (env < 0) [min, max] = [max, min];
getParamADSR(frequencyParam, attack, decay, sustain, release, min, max, start, end, 'exponential');
}
@ -243,17 +239,19 @@ export function createFilter(context, start, end, params, cps, cycle) {
}
const hasLFO = [depth, skew, shape, rate].some((v) => v !== undefined);
if (hasLFO) {
depth = depth ?? 1
const mag = Math.abs(depth);
const sign = Math.sign(depth);
const shaped = 2 ** (mag * (1 - dcoffset));
const dp = clamp((sign * shaped * frequency) - frequency, -20000, 20000);
console.info(dp)
depth = depth ?? 1;
const time = cycle / cps;
// let d = 2 ** -dcoffset
const lfoValues = { depth: dp, dcoffset, skew, shape, frequency: rate, min: 10, max: 20000, time };
const lfoValues = {
depth: (depth ?? 1) * frequency,
dcoffset,
skew,
shape,
frequency: rate ?? cps,
min: -frequency + 30,
max: 20000 - frequency,
time,
curve: 1,
};
getParamLfo(context, frequencyParam, start, end, lfoValues);
}
@ -403,7 +401,7 @@ export function applyFM(param, value, begin) {
duration,
} = value;
let modulator;
let stop = () => { };
let stop = () => {};
if (fmModulationIndex) {
const ac = getAudioContext();