mirror of
https://github.com/torlando-tech/pyxis.git
synced 2026-07-01 20:01:42 +00:00
6dbbe1bee7
VoiceFilterChain::applyHighPass collapsed to a constant-gain multiplier instead of a real high-pass response. The inner loop read `samples[prevIdx]` as "previous input" — but that slot held y[n-1] (output) since the previous iteration had overwritten it. Substituting that into the formula y[n] = α(y[n-1] + x[n] - x[n-1]) with x[n-1] := y[n-1] gave y[n] = α(y[n-1] + x[n] - y[n-1]) = α · x[n] i.e. just a fixed gain ≈ 0.81 at 300Hz cutoff / 8kHz. DC offsets sailed through; the chain only kept signal levels reasonable because the AGC stage downstream pulled the residual toward target. The same bug exists in upstream LXST-kt's native_audio_filters.cpp (filed as LXST-kt#13). Fix: walk per-channel with explicit `xPrev` / `yPrev` variables so input history isn't clobbered by the output write. Per-chunk save of `lastInputs[ch]` now stores the actual last input, not the last output, so the first sample of each new chunk uses the correct x[n-1]. Test `dc_offset_attenuated_by_hpf` updated to assert tail RMS < 0.01 (was < 0.5 — accommodating the broken behavior). Pass. End-to-end acoustic test (Mac speaker → T-Deck mic): pyxis_rms went up from 4378 → 5835, bot_rms from 1194 → 1517 — DC offset removal lets clean signal through better. Pyxis-side fix only. LXST-kt should pick up the same fix upstream — see project_lxst_hpf_filter_bug.md in the vault. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>