File: linux_voice_assistant/__main__.py
In _init_basics(), the --list-output-devices block is updated so that:
It exits with 0 on success.
It exits with 1 only if an exception occurs.
Wrap the board import in a try/except and introduce a _BOARD_AVAILABLE flag.
If board (or Blinka/platformdetect) is not available or fails, log a clear warning and skip hardware LED initialization.
Keep the event subscriptions intact, but ensure all LED actions become no-ops when _is_ready is False.
Removed the home-grown backend probing / priority logic (pipewire → pulse → alsa) when no device is explicitly configured.
Kept support for explicitly specifying an audio_output_device in the config/CLI; if provided, it is passed through to mpv.
Added debug logging after mpv initialization to show:
current ao
current audio-device
the full audio-device-list
New CLI helpers
Added support for:
script/run --list-input-devices
script/run --list-output-devices
These code paths:
Initialize just enough of the audio stack to enumerate devices.
Print a clean, human-readable list of input/output devices (including PipeWire / PulseAudio virtual devices like Echo-Cancel Source and pipewire/echo-cancel-sink).
Exit cleanly with status 0 instead of trying to start the full LVA process afterward (fixing the previous CalledProcessError when --list-output-devices was used).
Behavior change
__main__.py now treats the “list devices” modes as early-exit utility modes, not “run LVA and then also print devices”.
This makes it practical to use these commands in setup docs and shell scripts.
Behavioral & logging changes
Improved the wake word processing loop to make the following clearly visible in DEBUG logs:
The current set of active wake word IDs (MWW/OWW).
When the Stop wake word:
is activated by the model,
is accepted (i.e. meets refractory timing + is currently allowed), and
is ignored because it is no longer in active_wake_words.
Ensured the special stop model:
Is only treated as “active” when state.stop_word.is_active is True.
Is flipped back to inactive immediately after satellite.stop() is called, so:
The first “Stop” that passes all checks cancels playback and alarm tones.
Subsequent detections in the same moment appear as “TRIGGERED but IGNORED” (expected and now clearly logged).
Why this matters
When the LVA is playing audio (TTS or timer alarm), you can now:
See exactly when the Stop model fires.
Confirm that playback is being canceled at the right time.
Understand why you might see multiple “Stop wake word ACTIVATED” messages even though the alarm already stopped (model still “hearing” the tail, but logically ignored).
This matches the behavior seen in your logs:
At lower volumes / with AEC, stop is reliably accepted and playback stops immediately.
At high volumes without AEC, the model sees far less “clean” speech, so activations are rare or absent.
(Major change) main() function completely refactored into helpers. _init_controllers now handles decoupled initialization. _process_audio loop logic was fixed to correctly initialize wake words on startup.
mic.recorder() loop is now much more robust against OS buffering issue when the microphone is muted and wakewords were detected and processed after unmute.
__init__ was completely rewritten to be decoupled. It now listens for mic_muted/mic_unmuted events to manage its own state instead of reading from ServerState.
__init__ was completely rewritten to be decoupled. It now receives loop, event_bus, config, and preferences directly and no longer has any reference to ServerState.
ServerState is now a pure data container, no longer holding controller instances. The satellite reference was re-added, as it's required by the audio thread to call satellite.wakeup(). Fixed a TypeError by re-ordering non-default fields.
(Major change) main() function completely refactored into helpers. _init_controllers now handles decoupled initialization. _process_audio loop logic was fixed to correctly initialize wake words on startup.
Replaced sounddevice with soundcard, removed the audio Queue, added the new download directory to the search path, and added the device listing arguments