wyoming updates, borg manual, fedora kscreen, bambu wifi, vscode pylance, stable diffusion
Some checks failed
Reese's Arch Toolbox / build-and-push-arch-toolbox (push) Failing after 2m40s
Podman DDNS Image / build-and-push-ddns (push) Failing after 5s

This commit is contained in:
2025-05-23 13:49:03 -04:00
parent b3e4a45996
commit 7b93f740ec
16 changed files with 734 additions and 45 deletions

View File

@@ -1,4 +1,4 @@
- name: Create Backup Service
- name: Install or Update the Wyoming Service
hosts: wyoming
vars_files:
- secrets/vars.yaml

View File

@@ -4,9 +4,8 @@ wyoming:
repo: https://github.com/rhasspy/wyoming-satellite.git
listen_ip: 0.0.0.0
listen_port: 10700
mic_auto_gain: 5
mic_auto_gain: 31
mic_noise_suppression: 2
# mic_volume_multiplier: 8
wake_uri: tcp://127.0.0.1:10400
wake_word_name: jarvis_v2
wake_refractory_seconds: 1

View File

@@ -1,7 +1,11 @@
# Wyoming Satellite
- [Wyoming Satellite](#wyoming-satellite)
- [Data Flow](#data-flow)
- [Install Wyoming](#install-wyoming)
- [Hardware](#hardware)
- [Bluetooth keepalive](#bluetooth-keepalive)
- [Bluetooth autoconnect](#bluetooth-autoconnect)
- [On-device wake word](#on-device-wake-word)
- [Systemd](#systemd)
- [Debugging](#debugging)
@@ -11,26 +15,47 @@
- [Default](#default)
- [Starship House](#starship-house)
## Data Flow
```mermaid
sequenceDiagram
actor us as User
participant mic as Listening Device
participant ww as Wake Word Model
participant ha as Home Assistant
participant stt as Speech to Text
participant tts as Text to Speech
participant ai as LLM Tool Caller
us ->> mic: Say wakeword
mic ->> ww: Are you > x% confident the wake word was detected?
break When mic didn't detect wake word
ww ->> mic: No
mic ->> mic: keep listening
end
ww ->> mic: Yes
mic ->> us: "listening sound"
us ->> mic: Say request
mic ->> ha: Send audio to Home Assistant
ha ->> stt: Convert this speech to text
stt ->> ha: Here's the text
ha ->> mic: The user is done talking, here's what was said
mic ->> us: "done listening sound"
ha ->> ha: Did the text match any known intent?
alt Yes
ha ->> ha: Do the thing the intent is supposed to do
ha ->> tts: Turn the reply text into speech
tts ->> ha: here's the audio clip
ha ->> mic: play this audio clip
mic ->> user: audio clip
else No
ha ->> ai: Send entities exposed by Home Assistant, TTS, and "Can you figure this out?"
end
```
## Install Wyoming
<https://github.com/rhasspy/wyoming-satellite>
Some notes:
```bash
# Find microphone
arecord -L | grep plughw -A 2
# Create a test recording
arecord -D plughw:CARD=Speaker,DEV=0 -r 16000 -c 1 -f S16_LE -t wav -d 5 test.wav
# Find speaker
aplay -L | grep plughw -A 2
# Play test recording
aplay -D plughw:CARD=Speaker,DEV=0 test.wav
```
typical wyoming command:
```bash
@@ -53,6 +78,121 @@ script/run \
--threshold 0.9
```
## Hardware
Finding available speakers/microphones
```bash
# Find microphone
arecord -L | grep plughw -A 2
# Create a test recording
arecord -D plughw:CARD=Speaker,DEV=0 -r 16000 -c 1 -f S16_LE -t wav -d 5 test.wav
# Find speaker
aplay -L | grep plughw -A 2
# Play test recording
aplay -D plughw:CARD=Speaker,DEV=0 test.wav
# Change audio levels
alsamixer
# Save audio levels
sudo alsactl store
```
Bluetooth
```bash
bluetoothctl
discoverable on
pairable on
agent on
default-agent
scan on
```
Then wait for `[NEW] Device 12:23:34:45:56:67 devicename`
```bash
pair 12:23:34:45:56:67
```
The bluetooth speaker should now work with `aplay`.
### Bluetooth keepalive
Bluetooth speakers have a tendency to sleep and then take a bit to wake up. We can force
them to stay alive permanently by constantly playing an inaudible sound onloop.
```bash
# generate our 48000kHz sample rate synth 1 second sin 10hz wave file at -20dB so it's quiet
# This takes some tweaking depending on the speaker. A 1hz wave didn't work on my bluetooth speaker,
# but 10hz did.
sudo sox -V -r 48000 -n -b 16 -c 2 /usr/share/sounds/silence.wav synth 1 sin 10 vol -20dB
# Copy that to /usr/share/sounds
sudo cp silence.wav /usr/share/sounds
```
Create a script at `/usr/local/bin/speakeralive.sh`
```bash
#!/bin/bash
while true; do aplay /usr/share/sounds/silence.wav; done
```
Then create a systemd service at `~/.config/systemd/user/speakeralive.service`
```conf
[Unit]
Description=Plays an inaudible noise continuously to keep a speaker alive
After=network.target
Wants=network-online.target
[Service]
Restart=always
Type=simple
ExecStart=/usr/local/bin/speakeralive.sh
[Install]
WantedBy=bluetooth.target
```
And enable the service
```bash
systemctl --user enable --now speakeralive
```
### Bluetooth autoconnect
In order to automatically connect a bluetooth speaker at boot you'll need a oneshot service
Create `~/.config/systemd/user/speakerconnect.service`
```conf
[Unit]
Description=Connects a bluetooth speaker on boot
After=bluetooth.target
[Service]
Restart=on-failure
Type=oneshot
RestartSec=5
ExecStart=bluetoothctl connect A1:B2:C3:D4...
[Install]
WantedBy=bluetooth.target
```
Enable it
```bash
systemctl --user enable --now speakerconnect.service
```
## On-device wake word
<https://github.com/rhasspy/wyoming-openwakeword/>

View File

@@ -8,8 +8,8 @@ Type=simple
ExecStart={{ ansible_env.HOME }}/wyoming-satellite/script/run \
--name '{{ ansible_hostname }}' \
--uri 'tcp://{{ wyoming.listen_ip }}:{{ wyoming.listen_port }}' \
--mic-command 'arecord -r 16000 -c 1 -f S16_LE -t raw' \
--snd-command 'aplay -r 22050 -c 1 -f S16_LE -t raw' \
--mic-command 'arecord -r 16000 -c 1 -f S16_LE -t raw {% if hostvars[inventory_hostname].mic_device %}-D {{hostvars[inventory_hostname].mic_device}}{% endif %}' \
--snd-command 'aplay -r 22050 -c 1 -f S16_LE -t raw {% if hostvars[inventory_hostname].speaker_device %}-D {{hostvars[inventory_hostname].speaker_device}}{% endif %}' \
--awake-wav sounds/listening.wav \
--done-wav sounds/finished.wav \
--timer-finished-wav sounds/timer_finished.wav \