2c73493bf8
The gate loaded and worked on workpc and took mavwaked from 68% of one core to 335%. onnxruntime sizes its intra-op pool to every core and spins between runs, which an always-on gate scoring three graphs twelve times a second provokes for the whole day. One thread per session brings it to 81%, so the keyword costs about 13% of a core, and each graph still finishes well inside its 80ms. The unit now passes the three -wake- flags and the models sit beside silero_vad.onnx in ~/.local/share/maven/models. The threshold is left at the binary's default so there is one place to change it.
68 lines
3.3 KiB
Desktop File
68 lines
3.3 KiB
Desktop File
# mavwaked — always-on listening, on workpc where the microphone is.
|
|
#
|
|
# User unit, beside mavgpud.service and maven-voice-tunnel.service. It is a
|
|
# user unit because it needs his ALSA session and his ssh agent, and because
|
|
# it should stop when he logs out.
|
|
#
|
|
# The keyword is "Мэйвен" and the three -wake- flags are what require it
|
|
# (V-487 stage two). Without them anything spoken near the fifine becomes a
|
|
# turn, which voiceSender makes safe rather than expensive: it sends
|
|
# Surface=SurfaceVoice, capping every command at L0. That does not stop her
|
|
# answering out loud, which is the whole reason the keyword exists.
|
|
#
|
|
# The threshold is 0.999 and it is the binary's default, so it is not passed.
|
|
# It came from 65 minutes of held-out Russian speech through this same binary:
|
|
# 0.9 false wakes an hour against 2.8 at 0.99, for one lost render out of 126
|
|
# (docs/evals/2026-08-09-wake-word.md). If the room proves noisier than the
|
|
# corpus, read the scores out of this unit's journal and pass -wake-threshold.
|
|
# Do not lower it by guessing.
|
|
#
|
|
# A keyword shorter than 1.32s can be heard too late to be used, because the
|
|
# head scores 1.28s of audio and the VAD has closed the utterance by then.
|
|
# "Мэйвен, <request>" is unaffected. A bare "Мэйвен" is the case that fails.
|
|
#
|
|
# -vad-model is passed on purpose. Silero answers "is this frame speech" where
|
|
# the energy floor answers "is this frame loud". It declines white noise at
|
|
# the same RMS 0 frames to 68-99, and still hears all four spoken fixtures
|
|
# (docs/evals/2026-08-09-silero-vad.md). It costs 509us a frame, 1.7% of one
|
|
# core, and never touches the GPU. Drop the flag and the energy floor is back.
|
|
#
|
|
# -barge-in is NOT passed. The threshold is room-specific and this room has no
|
|
# number yet. Turn it on only after reading the "suppressed while speaking"
|
|
# means out of this unit's own journal, never by guessing.
|
|
#
|
|
# install: cp to ~/.config/systemd/user/ on workpc
|
|
# systemctl --user enable --now mavwaked.service
|
|
|
|
[Unit]
|
|
Description=Maven always-on listening (silero VAD, "Мэйвен" keyword)
|
|
# The tunnel is the only path to mavend and the only thing authenticating it.
|
|
Requires=maven-voice-tunnel.service
|
|
After=maven-voice-tunnel.service
|
|
|
|
[Service]
|
|
# card 0 is the fifine USB microphone. Named, and not "default", because the
|
|
# default device follows whatever pipewire last decided and this daemon should
|
|
# not change ears when he plugs in a headset.
|
|
#
|
|
# plughw and not hw. mavwaked asks arecord for 16kHz mono, which is what the
|
|
# whole pipeline is canonical in. The fifine offers 2 channels at 44100 or
|
|
# 48000 and nothing else, so bare hw:0,0 dies on "Channels count non
|
|
# available" before a frame is read. plughw puts ALSA's downmix and resampler
|
|
# in front. Any replacement microphone wants the same treatment.
|
|
Environment=LD_LIBRARY_PATH=%h/.local/lib
|
|
ExecStart=%h/.local/bin/mavwaked \
|
|
-device plughw:0,0 \
|
|
-addr 127.0.0.1:9100 \
|
|
-lang ru \
|
|
-vad-model %h/.local/share/maven/models/silero_vad.onnx \
|
|
-wake-model %h/.local/share/maven/models/maven_wakeword.onnx \
|
|
-wake-mel %h/.local/share/maven/models/melspectrogram.onnx \
|
|
-wake-embed %h/.local/share/maven/models/embedding_model.onnx \
|
|
-onnx-lib %h/.local/lib/libonnxruntime.so
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=default.target
|