From 525f5d87d1b83de1fd190095072f45748030e3b3 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Fri, 2 May 2025 22:50:00 -0400 Subject: [PATCH 1/2] adj resonance --- packages/superdough/superdough.mjs | 14 +++++++++++--- packages/superdough/worklets.mjs | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index a1dc30b7c..c7864f70b 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: .183, + hresonance: .183, + bandq: .183, channels: [1, 2], phaserdepth: 0.75, shapevol: 1, @@ -182,6 +182,10 @@ 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 +530,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); From 4e6ca54ef3302030a0beee7145bfc1d8ec8f778b Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Fri, 2 May 2025 22:51:44 -0400 Subject: [PATCH 2/2] lint --- packages/superdough/superdough.mjs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index c7864f70b..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: .183, - hresonance: .183, - bandq: .183, + resonance: 0.183, + hresonance: 0.183, + bandq: 0.183, channels: [1, 2], phaserdepth: 0.75, shapevol: 1, @@ -183,8 +183,7 @@ export function getAudioContextCurrentTime() { return getAudioContext().currentTime; } function applyResonanceCurve(res) { - return Math.min(30.03, Math.pow(res * 5.48, 2)) - + return Math.min(30.03, Math.pow(res * 5.48, 2)); } let workletsLoading; @@ -530,10 +529,10 @@ export const superdough = async (value, t, hapDuration) => { compressorRelease, } = value; - resonance = applyResonanceCurve(resonance) - hresonance = applyResonanceCurve(hresonance) - bandq = applyResonanceCurve(bandq) - + resonance = applyResonanceCurve(resonance); + hresonance = applyResonanceCurve(hresonance); + bandq = applyResonanceCurve(bandq); + gain = applyGainCurve(nanFallback(gain, 1)); postgain = applyGainCurve(postgain); shapevol = applyGainCurve(shapevol);