diff --git a/docs/linux-voice-assistant-2mic-install.md b/docs/linux-voice-assistant-2mic-install.md new file mode 100644 index 00000000..49bdcb8f --- /dev/null +++ b/docs/linux-voice-assistant-2mic-install.md @@ -0,0 +1,226 @@ +# Linux Voice Assistant on 2‑Mic Linux — Installation & Configuration Guide +# Created using ChatGPT 5 with the following prompt: +# Using the following github document as a guide +# https://github.com/rhasspy/wyoming-satellite/blob/master/docs/tutorial_2mic.md, +# take the attached bash history of commands and create a similar document +# detailing the installation and configuration of this linux-voice-assistant project. + +> Modeled after the Wyoming Satellite two‑mic tutorial, adapted from actual shell history. + +This guide reproduces a working setup of the **linux-voice-assistant** project with **Wyoming OpenWakeWord** on a Linux host with a 2‑mic HAT (e.g., seeed-2mic-voicecard). It assumes a fresh system with sudo access. + +## Prerequisites +- A Linux system (Debian/Ubuntu/Raspberry Pi OS or compatible) +- Python 3.11+ recommended +- A 2‑mic sound card +- Network access to your Home Assistant instance + +## 1. Install system packages + +```bash +sudo apt update +sudo apt upgrade +sudo apt install libportaudio2 build-essential git libmpv-dev mpv python3.11-dev +sudo reboot +``` + + +## 2. Get the code + +```bash +git clone https://github.com/imonlinux/linux-voice-assistant.git +git clone https://github.com/rhasspy/wyoming-openwakeword.git +``` + + +## 3. Wyoming OpenWakeWord (OWW) + +```bash +cp ./linux-voice-assistant/wyoming-openwakeword/requirements.txt ./wyoming-openwakeword/requirements.txt +cd wyoming-openwakeword/ +script/setup +``` + + +## 4. Configure audio devices + +Find your input/output device names and update the linux-voice-assistant/service/linux-voice-assistant.service file match sound card details: +```bash +arecord -l +aplay -l +``` + + +## 5. Systemd services + +Copy the 2 service files into /etc/systemd/system/: +```bash +sudo cp ./service/linux-voice-assistant.service /etc/systemd/system/linux-voice-assistant.service +sudo cp ./service/wyoming-openwakeword.service /etc/systemd/system/wyoming-openwakeword.service +``` +Start new services and confirm services are running: +```bash +sudo systemctl daemon-reload +sudo systemctl enable --now linux-voice-assistant +sudo systemctl status linux-voice-assistant wyoming-openwakeword --no-pager -l +``` + + +## 6. Connect to Home Assistant + +1. In Home Assistant, go to "Settings" -> "Device & services" +2. Click the "Add integration" button +3. Choose "ESPHome" and then "Set up another instance of ESPHome" +4. Enter the IP address of your voice satellite with port 6053 +5. Click "Submit" + + +## 7. Verification + +- Expect logs like `Connected to Home Assistant` +- Look for `[OWW] Detection: name=...` followed by re-arming/cycling +- Ask: *“What time is it?”* and confirm TTS reply + + +## 8. Change OWW detection model + +Edit the linux-voice-assistant.service file and change the OWW configuration argument for --wake-word-name. +Included OWW models include: + +```text +alexa_v0.1.tflite +embedding_model.tflite +hey_jarvis_v0.1.tflite +hey_mycroft_v0.1.tflite +hey_rhasspy_v0.1.tflite +melspectrogram.tflite +ok_nabu_v0.1.tflite +``` + +Additional community provided OWW models available from this repository: +https://github.com/fwartner/home-assistant-wakewords-collection + +Service file as provided using OWW 'ok_nabu': +```bash +sudo systemctl edit --force --full linux-voice-assistant.service +``` + +```text +[Unit] +Description=Linux Voice Assistant +Requires=wyoming-openwakeword.service +After=sound.target network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=/home/pi/linux-voice-assistant +ExecStart=/home/pi/linux-voice-assistant/script/run \ + --name 'Linux Satellite' \ + --audio-input-device seeed-2mic-voicecard \ + --audio-output-device alsa/hw:2,0 \ + --wake-uri 'tcp://127.0.0.1:10400' \ + --wake-word-name 'ok_nabu' +Restart=always +RestartSec=2 +Environment=PYTHONUNBUFFERED=1 + +[Install] +WantedBy=multi-user.target +``` + +Service file using OWW 'alexa': +```bash +sudo systemctl edit --force --full linux-voice-assistant.service +``` + +```text +[Unit] +Description=Linux Voice Assistant +Requires=wyoming-openwakeword.service +After=sound.target network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=/home/pi/linux-voice-assistant +ExecStart=/home/pi/linux-voice-assistant/script/run \ + --name 'Linux Satellite' \ + --audio-input-device seeed-2mic-voicecard \ + --audio-output-device alsa/hw:2,0 \ + --wake-uri 'tcp://127.0.0.1:10400' \ + --wake-word-name 'alexa' +Restart=always +RestartSec=2 +Environment=PYTHONUNBUFFERED=1 + +[Install] +WantedBy=multi-user.target +``` + +Reload systemd with updated linux-voice-assistant.service file and restart linux-voice-assistant.service and confirm successful run: +```bash +sudo systemctl daemon-reload +sudo systemctl restart linux-voice-assistant.service +sudo systemctl status linux-voice-assistant wyoming-openwakeword --no-pager -l +``` + +## 9. Revert to MicroWakeWord + +Edit the linux-voice-assistant.service file and remove the OWW configuration arguments: +Service file with OWW: +```bash +sudo systemctl edit --force --full linux-voice-assistant.service +``` + +```text +[Unit] +Description=Linux Voice Assistant +Requires=wyoming-openwakeword.service +After=sound.target network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=/home/pi/linux-voice-assistant +ExecStart=/home/pi/linux-voice-assistant/script/run \ + --name 'Linux Satellite' \ + --audio-input-device seeed-2mic-voicecard \ + --audio-output-device alsa/hw:2,0 \ + --wake-uri 'tcp://127.0.0.1:10400' \ + --wake-word-name 'ok_nabu' +Restart=always +RestartSec=2 +Environment=PYTHONUNBUFFERED=1 + +[Install] +WantedBy=multi-user.target +``` +Service file without OWW: +```text +[Unit] +Description=Linux Voice Assistant +Requires=wyoming-openwakeword.service +After=sound.target network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=/home/pi/linux-voice-assistant +ExecStart=/home/pi/linux-voice-assistant/script/run \ + --name 'Linux Satellite' \ + --audio-input-device seeed-2mic-voicecard \ + --audio-output-device alsa/hw:2,0 +Restart=always +RestartSec=2 +Environment=PYTHONUNBUFFERED=1 + +[Install] +WantedBy=multi-user.target +``` +Reload systemd with updated linux-voice-assistant.service file and restart linux-voice-assistant.service and confirm successful run: +```bash +sudo systemctl daemon-reload +sudo systemctl restart linux-voice-assistant.service +sudo systemctl status linux-voice-assistant wyoming-openwakeword --no-pager -l +``` diff --git a/service/wyoming-openwakeword.service b/service/wyoming-openwakeword.service new file mode 100644 index 00000000..02287658 --- /dev/null +++ b/service/wyoming-openwakeword.service @@ -0,0 +1,12 @@ +[Unit] +Description=Wyoming openWakeWord + +[Service] +Type=simple +ExecStart=/home/pi/wyoming-openwakeword/script/run --uri 'tcp://127.0.0.1:10400' +WorkingDirectory=/home/pi/wyoming-openwakeword +Restart=always +RestartSec=1 + +[Install] +WantedBy=default.target