From 56254a51fa15bc28fe7bb5ce26f4bd4528d6e719 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 13 Aug 2026 01:27:14 +0400 Subject: [PATCH] Isolate the Scarlett microphone capture channel (V-487) --- deploy/asoundrc | 27 +++++++++++++++++++++++++++ deploy/mavwaked.service | 31 ++++++++++++++++++++----------- 2 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 deploy/asoundrc diff --git a/deploy/asoundrc b/deploy/asoundrc new file mode 100644 index 0000000..dfd68b8 --- /dev/null +++ b/deploy/asoundrc @@ -0,0 +1,27 @@ +# mavmic — the Scarlett Solo 4th Gen microphone alone, for mavwaked. +# +# The card's USB capture stream is 4 channels, not 2: +# +# ch1 PCM 01 <- DSP 1 <- Analogue 1 the line/instrument jack +# ch2 PCM 02 <- DSP 2 <- Analogue 2 the XLR microphone +# ch3 PCM 03 <- Mix C <- PCM 1 loopback of workstation playback, L +# ch4 PCM 04 <- Mix D <- PCM 2 loopback of workstation playback, R +# +# plughw asks ALSA for mono and gets a downmix of all four, so half of what +# mavwaked scored was whatever the workstation was playing, at unity gain and +# untouched by the front-panel gain knob. Measured 2026-08-09 with the gain at +# 0 and a show playing: ch1 rms 0.00000, ch2 0.00002, ch3 0.08834, ch4 0.09045. +# +# Air and 48V are named for Line In 2, and both belong to a microphone preamp, +# so Analogue 2 is the XLR input on this card and Analogue 1 is the jack. +# +# This takes slave channel 1 and nothing else. It does not change the card, so +# the loopback stays available to everything else on the box. +pcm.mavmic { + type plug + slave { + pcm "hw:CARD=Gen,DEV=0" + channels 4 + } + ttable.0.1 1 +} diff --git a/deploy/mavwaked.service b/deploy/mavwaked.service index 6685bf4..7303a21 100644 --- a/deploy/mavwaked.service +++ b/deploy/mavwaked.service @@ -32,6 +32,7 @@ # means out of this unit's own journal, never by guessing. # # install: cp to ~/.config/systemd/user/ on workpc +# cp ../deploy/asoundrc to ~/.asoundrc on workpc # systemctl --user enable --now mavwaked.service [Unit] @@ -46,22 +47,30 @@ After=maven-voice-tunnel.service # it returns RMS 0.00004 with its capture switch on and its ALSA volume at the # full 496 of 496. That silence is in the hardware, so no flag reaches it. # -# Named CARD=Gen and not card 4, because a USB card number moves when -# something else is replugged and this daemon must not change ears quietly. +# mavmic and not plughw:CARD=Gen,DEV=0. deploy/asoundrc defines mavmic and +# carries the whole reason: the card's capture stream is 4 channels, and two of +# them are a unity-gain loopback of everything the workstation plays. plughw +# downmixes all four, so a TV show woke her with the gain knob at 0. Install +# that file as ~/.asoundrc on workpc or this device does not resolve. +# +# Named CARD=Gen inside mavmic and not card 4, because a USB card number moves +# when something else is replugged and this daemon must not change ears quietly. # Not "default" either: that follows whatever pipewire last decided. # -# plughw and not hw. mavwaked asks arecord for 16kHz mono, which is what the -# whole pipeline is canonical in. Neither microphone offers it, so bare hw -# dies on "Channels count non available" before a frame is read. plughw puts -# ALSA's downmix and resampler in front. Any replacement wants the same. +# mavmic is a plug device and not hw. mavwaked asks arecord for 16kHz mono, +# which is what the whole pipeline is canonical in. Neither microphone offers +# it, so bare hw dies on "Channels count non available" before a frame is read. +# Any replacement wants ALSA's resampler in front the same way. # -# The Scarlett measured RMS 0.003 against 0.14 on the onboard input, so its -# front-panel gain is the thing to raise if she mishears. That is a knob, not -# a control ALSA exposes. The two loud devices, the onboard ALC897 and the -# camera, both clip at peak 1.0 and are worse candidates, not better ones. +# The mic is on the XLR, which is Analogue 2 on this card and not Analogue 1: +# Air and 48V are both named for Line In 2 and both belong to a mic preamp. +# Measured 2026-08-09 through mavmic at 16kHz mono, gain up: rms 0.01826 peak +# 0.09290 spoken, against a 0.00031 preamp floor, and 0.00002 for the whole +# stream with a show playing. Front-panel gain is still the thing to raise if +# she mishears, and it is a knob, not a control ALSA exposes. Environment=LD_LIBRARY_PATH=%h/.local/lib ExecStart=%h/.local/bin/mavwaked \ - -device plughw:CARD=Gen,DEV=0 \ + -device mavmic \ -addr 127.0.0.1:9100 \ -lang ru \ -vad-model %h/.local/share/maven/models/silero_vad.onnx \