diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index a1dc30b7c..fe6be6c85 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -123,9 +123,9 @@ const defaultDefaultValues = { density: '.03', ftype: '12db', fanchor: 0, - resonance: 1, - hresonance: 1, - bandq: 1, + resonance: 0.183, + hresonance: 0.183, + bandq: 0.183, channels: [1, 2], phaserdepth: 0.75, shapevol: 1, @@ -182,6 +182,9 @@ export const getAudioContext = () => { export function getAudioContextCurrentTime() { return getAudioContext().currentTime; } +function applyResonanceCurve(res) { + return Math.min(30.03, Math.pow(res * 5.48, 2)); +} let workletsLoading; function loadWorklets() { @@ -526,6 +529,10 @@ export const superdough = async (value, t, hapDuration) => { compressorRelease, } = value; + resonance = applyResonanceCurve(resonance); + hresonance = applyResonanceCurve(hresonance); + bandq = applyResonanceCurve(bandq); + gain = applyGainCurve(nanFallback(gain, 1)); postgain = applyGainCurve(postgain); shapevol = applyGainCurve(shapevol); diff --git a/packages/superdough/worklets.mjs b/packages/superdough/worklets.mjs index 03d3a966f..5fef9ae1d 100644 --- a/packages/superdough/worklets.mjs +++ b/packages/superdough/worklets.mjs @@ -295,7 +295,7 @@ class LadderProcessor extends AudioWorkletProcessor { cutoff = (cutoff * 2 * _PI) / sampleRate; cutoff = cutoff > 1 ? 1 : cutoff; - const k = Math.min(8, resonance * 0.4); + const k = Math.min(8, resonance * 0.13); // drive makeup * resonance volume loss makeup let makeupgain = (1 / drive) * Math.min(1.75, 1 + k);