From f8796d039ff90d4408068cff633cc2933617fbf9 Mon Sep 17 00:00:00 2001 From: Aria Date: Wed, 19 Nov 2025 17:18:38 -0600 Subject: [PATCH] Add param guesses --- packages/superdough/superdough.mjs | 36 +++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 4cd713763..df1090a83 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -408,7 +408,38 @@ function _getNodeParams(node) { return Array.from(params); } +const targetToParamGuess = { + source: 'detune', + lpf: 'frequency', + bpf: 'frequency', + hpf: 'frequency', + distort: 'distort', + gain: 'gain', + vowel: 'frequency', + coarse: 'coarse', + crush: 'crush', + shape: 'shape', + compressor: 'threshold', + pan: 'pan', + phaser: 'rate', + post: 'gain', + delay: 'time', + room: 'size', + djf: 'value', + lfo: 'frequency', + env: 'depth', + send: 'depth', +} + function _getTargetParams(nodes, target) { + let param; + if (target.includes('.')) { + const split = target.split('.'); + target = split[0]; + param = split[1]; + } else { + param = targetToParamGuess[target]; + } const targetNodes = nodes[target]; if (!targetNodes) { const keys = Object.keys(nodes); @@ -422,13 +453,12 @@ function _getTargetParams(nodes, target) { } const audioParams = []; targetNodes.forEach((targetNode) => { - const paramName = guessParamName(blah); - const targetParam = _getNodeParam(targetNode, paramName); + const targetParam = _getNodeParam(targetNode, param); if (!targetParam) { const available = _getNodeParams(targetNode); errorLogger( new Error( - `Could not connect to parameter '${paramName}' on '${targetName}'. Available parameters: ${available.join(', ')}`, + `Could not connect to parameter '${param}' on '${targetName}'. Available parameters: ${available.join(', ')}`, ), 'superdough', );