diff --git a/AGENTS.md b/AGENTS.md index 016b5b5..08e3ace 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -557,7 +557,7 @@ CLI, unit tests (24) + integration tests (2). `--codegen-model`) override the values read from `config.json` **for that run only** and are never written back. `--voice` additionally installs the optional voice-gateway stack (`requirements/voice.txt` + system - `libportaudio2`) and downloads its models into `.runtime/voice/` via + `libportaudio2` + `alsa-utils`) and downloads its models into `.runtime/voice/` via `scripts/voice-models.py`. The script must be run from a checkout — it reads pins from that checkout's `pins.json` and never re-clones the agent repo (only the SemIf engine and the simplex-chat binary). Idempotent and @@ -1028,7 +1028,7 @@ CLI, unit tests (24) + integration tests (2). stays stdlib-only. The voice stack is pinned separately in `requirements/voice.txt` (hardware-dependent: `sounddevice`, `openwakeword`, `faster-whisper`, `piper-tts`, `onnxruntime`, `webrtcvad-wheels`, plus the - system `libportaudio2`); it is lazy-imported too, and `bootstrap.sh --voice` + system `libportaudio2` + `alsa-utils`); it is lazy-imported too, and `bootstrap.sh --voice` installs it and downloads the models (openWakeWord into the venv package dir, the Piper voice into `.runtime/voice/tts`, faster-whisper into `.runtime/hf`). diff --git a/README.md b/README.md index 698b059..466cf30 100644 --- a/README.md +++ b/README.md @@ -650,8 +650,10 @@ python -m semif_agent.cli gateway --platform voice - **Requirements.** The voice stack is optional and lazy-imported; install it with `scripts/bootstrap.sh --voice` (or `.runtime/venv/bin/pip install -r requirements/voice.txt`) plus the system - PortAudio lib (`apt install libportaudio2`). The gateway refuses to start with - an install hint if the stack is missing. + PortAudio lib and ALSA mixer tools (`apt install libportaudio2 alsa-utils`). + The gateway refuses to start with an install hint if the stack is missing. + PortAudio has no volume control — use `alsamixer`/`amixer` (then + `sudo alsactl store`) to unmute and set the mic/speaker levels. - **Models.** `gateway.voice.wake.model` is an openWakeWord model (default `hey_mycroft`), `stt.model` a faster-whisper size (default `base.en`), and `tts.voice` a Piper voice (default `en_US-lessac-medium`). Bootstrap downloads diff --git a/requirements/voice.txt b/requirements/voice.txt index c72df1b..e94e67b 100644 --- a/requirements/voice.txt +++ b/requirements/voice.txt @@ -7,7 +7,10 @@ # .runtime/venv/bin/pip install -r requirements/voice.txt # .runtime/venv/bin/pip install --no-deps openwakeword==0.6.0 # -# System prerequisite (not pip): PortAudio, e.g. `apt-get install -y libportaudio2`. +# System prerequisites (not pip): PortAudio + ALSA mixer tools, e.g. +# `apt-get install -y libportaudio2 alsa-utils`. PortAudio is the I/O backend; +# alsa-utils provides amixer/alsamixer/alsactl to unmute and set mic/speaker +# levels (PortAudio itself has no volume control). # # The audio pipeline is 16 kHz mono int16: # sounddevice mic capture + speaker playback (raw PortAudio streams) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 7d39f9e..14f4a7a 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -248,10 +248,18 @@ CMAKE_BUILD_PARALLEL_LEVEL=6 MAKEFLAGS=-j6 "$PIP" install -r "$REPO_ROOT/require # Hardware-dependent: only the host with a microphone/speaker needs it. The # stack is lazy-imported, so a host without it still runs every other front end. if [[ "$VOICE" = 1 ]]; then - if ! dpkg -s libportaudio2 >/dev/null 2>&1; then - echo "== installing system PortAudio (libportaudio2)" + # libportaudio2 is the I/O backend sounddevice needs; alsa-utils provides + # amixer/alsamixer/alsactl so the operator can unmute and set the mic/speaker + # levels (PortAudio itself has no volume control). + VOICE_SYS_PKGS=(libportaudio2 alsa-utils) + voice_missing=() + for p in "${VOICE_SYS_PKGS[@]}"; do + dpkg -s "$p" >/dev/null 2>&1 || voice_missing+=("$p") + done + if [[ ${#voice_missing[@]} -gt 0 ]]; then + echo "== installing voice system prereqs: ${voice_missing[*]}" sudo apt-get update - sudo apt-get install -y libportaudio2 + sudo apt-get install -y "${voice_missing[@]}" fi echo "== installing voice deps into $VENV" "$PIP" install -r "$REPO_ROOT/requirements/voice.txt" @@ -543,6 +551,12 @@ Voice command gateway (wake word + speech-to-text + text-to-speech): - Say the wake word (gateway.voice.wake.model, default 'hey_mycroft') and speak; the reply is spoken back. After each reply the next utterance needs no wake word for gateway.voice.follow_up_window_s. + - If the mic or speaker is silent/quiet, set the ALSA mixer (PortAudio has no + volume control) and persist it: + alsamixer # or: amixer -c sset 'Speaker' unmute + sudo alsactl store + List devices with: $PYTHON -c "import sounddevice as sd; print(sd.query_devices())" + and put the input/output device indices in gateway.voice.audio. - Re-download / switch models any time with: HF_HOME="$HF_CACHE" "$PYTHON" scripts/voice-models.py --config config.json EOF