From d7889c6f23eb697da65bbae2ca1d54da38cd5b12 Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 18 Jun 2026 18:25:12 -0400 Subject: [PATCH] fix: _process_4cm handles 1D mono input gracefully MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When routing mode is '4cm' but JACK provides mono audio (1D array), the _process_4cm method crashes with IndexError on audio_in[0,:]. Treat mono input as guitar channel with silent return channel. This happens when JACK is configured with 1 capture port (mono mode) but routing_mode is set to '4cm' — e.g. after a settings sweep that toggles routing_mode without changing JACK port config. --- src/dsp/pipeline.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dsp/pipeline.py b/src/dsp/pipeline.py index 1fab85c..b7443b4 100644 --- a/src/dsp/pipeline.py +++ b/src/dsp/pipeline.py @@ -718,8 +718,14 @@ class AudioPipeline: ch0 = Send output (to amp input) ch1 = Return output (to amp FX return) """ - ch0 = audio_in[0, :].copy() - ch1 = audio_in[1, :].copy() + if audio_in.ndim == 1: + # Mono input in 4CM mode — treat entire input as guitar + # channel, create silent return channel + ch0 = audio_in.copy() + ch1 = np.zeros_like(audio_in) + else: + ch0 = audio_in[0, :].copy() + ch1 = audio_in[1, :].copy() # ── 60Hz mains hum notch filter on both channels ──────────── b0, b1, b2 = self._notch_b0, self._notch_b1, self._notch_b2