diff --git a/packages/supradough/dough.mjs b/packages/supradough/dough.mjs index 1cb9241a..ea572224 100644 --- a/packages/supradough/dough.mjs +++ b/packages/supradough/dough.mjs @@ -1,5 +1,5 @@ // this is dough, the superdough without dependencies -// @ts-check +// @ts-nocheck // @ts-ignore ignore next line because sampleRate is unknown const SAMPLE_RATE = typeof sampleRate !== 'undefined' ? sampleRate : 48000; const PI_DIV_SR = Math.PI / SAMPLE_RATE; @@ -151,7 +151,8 @@ export class TwoPoleFilter { resonance = Math.max(resonance, 0); cutoff = Math.min(cutoff, 20000); - const c = 2 * Math.sin(cutoff * PI_DIV_SR); + let c = 2 * Math.sin(cutoff * PI_DIV_SR); + c = clamp(c, 0, 1.14); // this line prevents instability TODO: test const r = Math.pow(0.5, (resonance + 0.125) / 0.125); const mrc = 1 - r * c;