Review fix: exact-silence input mute (hard kill-switch gate)

External review found the lagged mute gate leaks a faint transient (~-54 dB) on
its first blocks: Lag seeds its state at 0, so gating on a lagged value never
starts at exactly zero on a rig that comes up muted — the moment the mute is
meant to keep things quiet. Measured directly via an NRT render.

- Gate the input with a hard, un-lagged kill switch `(inputMute - 1) * -1` in
  both HardwareInputPassThrough and TestLoopTap. A muted node is then exactly
  silent from the first sample; a kill-switch mute is expected to be abrupt.
  Drop the now-unused muteLagTime constant.
- Flip the library default to `inputMuted = false` (audible). Muting is the app's
  Start-time policy (EngineConfigView already re-asserts muted on user Start), so
  headless/offline library use isn't forced silent and render tests that route the
  test-loop through a board no longer depend on a leak to see signal. The pulsing
  glow now also starts at engine Start rather than before it.
- Tests: add render-level mutedInputRendersSilent (exact silence) and
  unmutedInputRendersSignal; update the default-state and MIDI-latch expectations;
  drop the StereoRouting un-mutes that the leak had made necessary.
- Plan doc: correct the mute default / gate description and the UserDefaults note.

463 tests pass; both app targets build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-11 16:03:50 -07:00
parent be0e3d118b
commit b29c8848ef
7 changed files with 89 additions and 48 deletions
@@ -70,7 +70,6 @@ struct StereoRoutingTests {
#expect(board.outputBusRight != nil, "Stereo board should have a right tail bus")
try shoeGaze.finalizeBoard(board)
shoeGaze.setInputMuted(false) // input defaults muted; un-mute so the test-loop signal renders
try engine.start()
let samples: [Float] = readStereoCAF(url: url)
@@ -104,7 +103,6 @@ struct StereoRoutingTests {
#expect(delay.outputBusRight != nil, "Auto-stereoized pedal should have a right output bus")
try shoeGaze.finalizeBoard(board)
shoeGaze.setInputMuted(false) // input defaults muted; un-mute so the test-loop signal renders
try engine.start()
let samples: [Float] = readStereoCAF(url: url)
@@ -130,7 +128,6 @@ struct StereoRoutingTests {
#expect(board.width == 2, "Stereo-native pedal should widen a mono board")
try shoeGaze.finalizeBoard(board)
shoeGaze.setInputMuted(false) // input defaults muted; un-mute so the test-loop signal renders
try engine.start()
let samples: [Float] = readStereoCAF(url: url)
@@ -159,7 +156,6 @@ struct StereoRoutingTests {
try board.add(ReverbPedal()) // mono pedal after merge, width-1
try shoeGaze.finalizeBoard(board)
shoeGaze.setInputMuted(false) // input defaults muted; un-mute so the test-loop signal renders
try engine.start()
let samples: [Float] = readStereoCAF(url: url)
@@ -207,7 +203,6 @@ struct StereoRoutingTests {
#expect(board.width == 2, "collectStereo should make the board stereo")
try shoeGaze.finalizeBoard(board)
shoeGaze.setInputMuted(false) // input defaults muted; un-mute so the test-loop signal renders
try engine.start()
return deinterleave(readStereoCAF(url: url))
@@ -297,7 +292,6 @@ struct StereoRoutingTests {
#expect(board.outputBusRight == nil)
try shoeGaze.finalizeBoard(board)
shoeGaze.setInputMuted(false) // input defaults muted; un-mute so the test-loop signal renders
try engine.start()
let samples: [Float] = readStereoCAF(url: url)