Wyoming Satellite

repository·master·Indexed 21 days ago

https://github.com/rhasspy/wyoming-satellite

A remote voice satellite client using the Wyoming protocol to communicate with voice services like Home Assistant. It handles audio capture, playback, and supports both remote and local wake word detection, Voice Activity Detection (VAD), and audio enhancements such as automatic gain control and noise suppression.

Tokens
9.5K
Snippets
15
Records
51
Agent score
79%

What's inside wyoming-satellite

  1. Install wyoming-satellite on Raspberry Pi

    master

    To install wyoming-satellite, first install system dependencies, clone the repository, and (if using ReSpeaker HATs) install drivers. Then, set up a Python virtual environment and install the package with its dependencies.

    System Dependencies:

    sudo apt-get update
    sudo apt-get install --no-install-recommends git python3-venv

    Driver Installation (ReSpeaker 2Mic/4Mic HAT only):

    cd wyoming-satellite/
    sudo bash etc/install-respeaker-drivers.sh
    sudo reboot

    Python Environment Setup:

    cd wyoming-satellite/
    python3 -m venv .venv
    .venv/bin/pip3 install --upgrade pip
    .venv/bin/pip3 install --upgrade wheel setuptools
    .venv/bin/pip3 install -f 'https://synesthesiam.github.io/prebuilt-apps/' -e '.[all]'
    sudo apt-get update
    sudo apt-get install --no-install-recommends  \
      git \
      python3-venv
    
    git clone https://github.com/rhasspy/wyoming-satellite.git
    
    # If using ReSpeaker HATs:
    cd wyoming-satellite/
    sudo bash etc/install-respeaker-drivers.sh
    sudo reboot
    
    # After reboot:
    cd wyoming-satellite/
    python3 -m venv .venv
    .venv/bin/pip3 install --upgrade pip
    .venv/bin/pip3 install --upgrade wheel setuptools
    .venv/bin/pip3 install \
      -f 'https://synesthesiam.github.io/prebuilt-apps/' \
      -e '.[all]'
  2. Run Wyoming Satellite with Local Wake Word Detection

    master

    Local wake word detection allows the satellite to process the wake word itself, only streaming audio to the server after the word is detected. This requires running a local wake word service (like wyoming-openwakeword) on the same device or network.

    Configuration:

    • Use --wake-uri to point to the local wake word service.
    • Use --wake-word-name to specify which model to use (e.g., ok_nabu).
    • Use --custom-model-dir <DIR> to provide a directory containing custom .tflite models.
    • Use --wake-refractory-seconds <SECONDS> to adjust the period during which the wake word cannot be detected again.

    Note: When using local wake word detection, the --vad flag is unnecessary.

    # 1. Start the wake word service
    cd wyoming-openwakeword/
    script/run \
      --uri 'tcp://0.0.0.0:10400' \
      --preload-model 'ok_nabu'
    
    # 2. Start the satellite with local wake word config
    cd wyoming-satellite/
    script/run \
      --name 'my satellite' \
      --uri 'tcp://0.0.0.0:10700' \
      --mic-command 'arecord -r 16000 -c 1 -f S16_LE -t raw' \
      --snd-command 'aplay -r 22050 -c 1 -f S16_LE -t raw' \
      --wake-uri 'tcp://127.0.0.1:10400' \
      --wake-word-name 'ok_nabu'
  3. Configure LED event services for ReSpeaker HATs

    master

    You can use event services to change LED colors based on the satellite's state. For ReSpeaker 2Mic/4Mic HATs, use the example scripts provided in the examples directory.

    1. Install LED service dependencies:

    cd wyoming-satellite/examples
    python3 -m venv --system-site-packages .venv
    .venv/bin/pip3 install --upgrade pip
    .venv/bin/pip3 install --upgrade wheel setuptools
    .venv/bin/pip3 install 'wyoming==1.5.2'
    # For USB 4mic array v2.0:
    .venv/bin/pip3 install 'pixel-ring'

    Note: If gpiozero or spidev are missing, install them via sudo apt-get install python3-spidev python3-gpiozero.

    2. Create the LED service: Create /etc/systemd/system/2mic_leds.service:

    [Unit]
    Description=2Mic LEDs
    
    [Service]
    Type=simple
    ExecStart=/home/pi/wyoming-satellite/examples/.venv/bin/python3 2mic_service.py --uri 'tcp://127.0.0.1:10500'
    WorkingDirectory=/home/pi/wyoming-satellite/examples
    Restart=always
    
    [Install]
    WantedBy=default.target

    3. Connect Satellite to LED service: Update wyoming-satellite.service to require the LED service and provide the --event-uri:

    [Unit]
    Requires=2mic_leds.service
    
    [Service]
    ExecStart=/home/pi/wyoming-satellite/script/run ... --event-uri 'tcp://127.0.0.1:10500'

    4. Control LED brightness: Use the --led-brightness <1-31> argument in the LED service command to adjust brightness.

    cd wyoming-satellite/examples
    python3 -m venv --system-site-packages .venv
    .venv/bin/pip3 install --upgrade pip
    .venv/bin/pip3 install --upgrade wheel setuptools
    .venv/bin/pip3 install 'wyoming==1.5.2'
    
    # If using ReSpeaker USB 4mic array v2.0:
    .venv/bin/pip3 install 'pixel-ring'
  4. Run Wyoming Satellite with Remote Wake Word Detection

    master

    In remote mode, the satellite continuously streams audio to a server (like Home Assistant) where wake word detection and processing occur.

    Use --mic-command and --snd-command to specify how to record and play audio. If you need to target specific hardware devices, use the -D <DEVICE> flag within your commands (e.g., arecord -D plughw:1 ...).

    To integrate with Home Assistant, the satellite should be discovered automatically via the Wyoming Protocol on port 10700. If not discovered, manually add the 'Wyoming Protocol' integration using the satellite's IP address.

    cd wyoming-satellite/
    script/run \
      --name 'my satellite' \
      --uri 'tcp://0.0.0.0:10700' \
      --mic-command 'arecord -r 16000 -c 1 -f S16_LE -t raw' \
      --snd-command 'aplay -r 22050 -c 1 -f S16_LE -t raw'
  5. Set up local wake word detection with openWakeWord

    master

    To enable local wake word detection, you must run an openWakeWord service alongside the satellite. The satellite connects to the wake service via the --wake-uri flag.

    1. Install openWakeWord dependencies and service:

    sudo apt-get install --no-install-recommends libopenblas-dev
    git clone https://github.com/rhasspy/wyoming-openwakeword.git
    cd wyoming-openwakeword
    script/setup

    2. Configure openWakeWord as a systemd service: Create /etc/systemd/system/wyoming-openwakeword.service with:

    [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

    3. Link Satellite to Wake Service: Update your wyoming-satellite.service to require the wake service and point to its URI:

    [Unit]
    Requires=wyoming-openwakeword.service
    
    [Service]
    ExecStart=/home/pi/wyoming-satellite/script/run ... --wake-uri 'tcp://127.0.0.1:10400' --wake-word-name 'ok_nabu'

    4. Apply changes:

    sudo systemctl daemon-reload
    sudo systemctl restart wyoming-satellite.service
    sudo apt-get update
    sudo apt-get install --no-install-recommends  \
      libopenblas-dev
    
    git clone https://github.com/rhasspy/wyoming-openwakeword.git
    cd wyoming-openwakeword
    script/setup
  6. Determine audio devices for microphone and speaker

    master

    Before running the satellite, you must identify the correct hardware device identifiers for your microphone and speaker. Use arecord -L to list microphones and aplay -L to list speakers.

    For ReSpeaker HATs, look for plughw:CARD=seeed2micvoicec,DEV=0. For other devices, prefer those starting with plughw: or use default.

    Testing Microphone: Record a 5-second sample using arecord with the -D <device> flag.

    arecord -D <device> -r 16000 -c 1 -f S16_LE -t wav -d 5 test.wav

    Testing Speaker: Play back the sample using aplay with the -D <device> flag.

    aplay -D <device> test.wav
    arecord -L
    aplay -L
    
    # Test recording
    arecord -D plughw:CARD=seeed2micvoicec,DEV=0 -r 16000 -c 1 -f S16_LE -t wav -d 5 test.wav
    
    # Test playback
    aplay -D plughw:CARD=seeed2micvoicec,DEV=0 test.wav
  7. Install Wyoming Satellite

    master

    To install the Wyoming Satellite, first install the required Python system dependencies, then run the provided setup script. You will also need alsa-utils if you intend to use arecord and aplay for audio handling.

    Prerequisites:

    • Python 3.7+ (tested on 3.9+)
    • A microphone
  8. Configure Satellite, Microphone, and Speaker settings via Installer

    master

    The installer provides a menu-driven interface to configure the satellite hardware and software. Follow these steps to set up a complete voice satellite:

    Satellite Type

    • Navigate to the Satellite menu.
    • Select Satellite Type and choose Local wake word detection.

    Microphone Setup

    • Ensure your USB microphone is connected.
    • In the Microphone menu, select Autodetect and speak into the device to identify it.
    • In Audio Settings, set Noise Suppression to Medium and Auto Gain to 15.

    Speaker Setup

    • Ensure your USB speakers are connected.
    • In the Speakers menu, use Test All Speakers and Play Sound to identify the correct device.
    • In Toggle Feedback Sounds, enable both On wake-up and After voice command.

    Wake Word Setup

    • In the Wake Word menu, select Wake Word System and choose openWakeWord. Follow prompts to install it if required.
    • In the openWakeWord menu, select Download Community Wake Words.
    • Return to the Wake Word menu and use Choose Wake Word to select your desired wake word.
  9. Enable Voice Activity Detection (VAD)

    master

    Voice Activity Detection (VAD) prevents continuous audio streaming by only sending audio to the server when speech is actually detected.

    Note: VAD is not supported on 32-bit versions of Raspberry Pi OS.

    To use VAD, you must first install the pysilero-vad dependency in your virtual environment and then include the --vad flag when running the satellite.

  10. Install dependencies and run the Wyoming Satellite installer

    master

    Before running the installer on your satellite (e.g., a Raspberry Pi), ensure system dependencies are installed and the repository is cloned. You can then launch the interactive installer using the installer module.

    1. Update system and install git and python3-venv.
    2. Clone the wyoming-satellite repository.
    3. Run the installer via python3 -m installer.
    sudo apt-get update
    sudo apt-get install --no-install-recommends  \
      git \
      python3-venv
    
    git clone https://github.com/rhasspy/wyoming-satellite.git
    
    cd wyoming-satellite/
    python3 -m installer
  11. Apply Audio Enhancements (Gain and Noise Suppression)

    master

    To improve audio quality, you can install webrtc-noise-gain and use the following flags:

    • --mic-auto-gain <0-31>: Sets automatic gain control in dbFS (31 is loudest).
    • --mic-noise-suppression <0-4>: Sets noise suppression level (4 is maximum, but may cause distortion).
    • --mic-volume-multiplier <X>: Multiplies all microphone audio samples by X.
    • --snd-volume-multiplier <X>: Multiplies all playback audio samples by X.