From 70c858016ffe9e4e14e9edebb4c85b42cfff1d33 Mon Sep 17 00:00:00 2001 From: monkey-w1n5t0n Date: Sat, 11 Apr 2026 08:20:24 +0200 Subject: [PATCH] fix(a-app): gate modular MLP routing on example count to preserve default patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modular mode's default patch sets MM_Matrix/s00_d08_amp = 1.0 via _setRawByLabel at engine init, but on the first inference tick routeOutputs writes the untrained MLP's output (~0.5 normalised) to every paramMeta index. For matrix cells the raw range is [-1, 1], so normalised 0.5 denormalises to 0 — clobbering the default amp routing and killing all audio. Skip the setParam loop for modular when iml.exampleCount === 0, so the worklet keeps running on the default patch we already pushed at init. Once the user captures at least one training example the MLP has a target to reproduce, and routing resumes normally. Only affects modular mode; other engines are unchanged. --- playground/js/a-app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/playground/js/a-app.js b/playground/js/a-app.js index 7206609..84d61da 100644 --- a/playground/js/a-app.js +++ b/playground/js/a-app.js @@ -2398,8 +2398,16 @@ function routeOutputs(outputs) { modularUI.updateLive(overridden); } + // Modular mode cold-start gate: with no training examples, an untrained + // MLP produces outputs around 0.5 which denormalise to ~0 for matrix + // cells (min=-1, max=1) and clobber the default patch's s00_d08_amp=1.0. + // Result: silence. Until the user captures at least one example, leave + // the worklet running on the default patch we already pushed at init. + const skipModularRouting = activeEngine?.id === 'modular' && + (iml?.exampleCount ?? 0) === 0; + // Engine param updates: throttle + dead-zone filter - if (activeEngine && activeEngine.running) { + if (activeEngine && activeEngine.running && !skipModularRouting) { const now = performance.now(); if (now - _lastParamSendTime >= PARAM_SEND_INTERVAL) { _lastParamSendTime = now;