mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-11 01:34:41 +02:00
- tools/hermes-voice/ : pipeline VAD → faster-whisper → LiteLLM → piper TTS - mot-clé "hermes" détecté dans la transcription Whisper (pas de wake word model) - modes : VAD continu + push-to-talk + --no-tts pour debug - nftables : ouvrir port 4000 LiteLLM vers LAN domestique (192.168.1.0/24) - admin/ia/hermes-voice.md : documentation installation et utilisation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
119 lines
3.7 KiB
Markdown
119 lines
3.7 KiB
Markdown
# Hermes Voice Client
|
|
|
|
Client vocal local pour interagir avec Hermes via la voix depuis le poste perso.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Micro → VAD (énergie) → faster-whisper (STT) → LiteLLM :4000 → piper (TTS) → Haut-parleur
|
|
```
|
|
|
|
- **STT** : faster-whisper `small` sur CPU (9950X3D) — ~0.3s de latence
|
|
- **Détection** : mot-clé "hermes" dans la transcription Whisper (pas de wake word model)
|
|
- **LLM** : modèle `hermes-default` via LiteLLM sur storage-01
|
|
- **TTS** : piper avec voix `fr_FR-upmc-medium`
|
|
|
|
## Installation
|
|
|
|
### Dépendances Python
|
|
|
|
```bash
|
|
cd tools/hermes-voice/
|
|
python3 -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### Piper TTS
|
|
|
|
```bash
|
|
# Télécharger la release piper depuis https://github.com/rhasspy/piper/releases
|
|
# ex : piper_linux_x86_64.tar.gz
|
|
|
|
mkdir -p ~/.local/share/piper-runtime ~/.local/share/piper
|
|
tar xf piper_linux_x86_64.tar.gz -C /tmp
|
|
cp -r /tmp/piper/* ~/.local/share/piper-runtime/
|
|
|
|
# Voix française
|
|
wget -O ~/.local/share/piper/fr_FR-upmc-medium.onnx \
|
|
"https://huggingface.co/rhasspy/piper-voices/resolve/main/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.onnx"
|
|
wget -O ~/.local/share/piper/fr_FR-upmc-medium.onnx.json \
|
|
"https://huggingface.co/rhasspy/piper-voices/resolve/main/fr/fr_FR/upmc/medium/fr_FR-upmc-medium.onnx.json"
|
|
```
|
|
|
|
### Test piper
|
|
|
|
```bash
|
|
echo "Bonjour, je suis Hermes." | \
|
|
LD_LIBRARY_PATH=~/.local/share/piper-runtime \
|
|
~/.local/share/piper-runtime/piper \
|
|
--model ~/.local/share/piper/fr_FR-upmc-medium.onnx \
|
|
--output_file /tmp/test.wav && aplay /tmp/test.wav
|
|
```
|
|
|
|
Si `aplay` manque : `sudo dnf install alsa-utils`
|
|
|
|
### Réseau
|
|
|
|
Le port 4000 (LiteLLM) doit être accessible depuis le LAN domestique (`192.168.1.0/24`).
|
|
Déjà ouvert dans `ansible/roles/gateway/templates/nftables.conf.j2` depuis le 2026-06-02.
|
|
|
|
Vérification :
|
|
```bash
|
|
curl -s http://192.168.1.200:4000/v1/models -H "Authorization: Bearer lm-studio"
|
|
```
|
|
|
|
## Utilisation
|
|
|
|
```bash
|
|
cd tools/hermes-voice/
|
|
source .venv/bin/activate
|
|
|
|
# Mode VAD — parler naturellement, commencer par "Hermes, ..."
|
|
python hermes-voice.py
|
|
|
|
# Mode push-to-talk — Entrée pour démarrer/terminer
|
|
python hermes-voice.py --ptt
|
|
|
|
# Sans TTS (réponses texte uniquement — pour déboguer)
|
|
python hermes-voice.py --ptt --no-tts
|
|
```
|
|
|
|
## Mode VAD
|
|
|
|
Le client écoute en continu. Quand de l'énergie vocale est détectée :
|
|
1. Enregistrement jusqu'à 1.5s de silence
|
|
2. Whisper transcrit
|
|
3. Si "hermes" apparaît dans les 5 premiers mots → la commande est envoyée à LiteLLM
|
|
4. Sinon → ignoré (conversations ambiantes non captées)
|
|
|
|
Exemple : *"Hermes, quel est l'état du cluster ?"*
|
|
|
|
## Configuration (`hermes-voice.py`)
|
|
|
|
| Variable | Défaut | Description |
|
|
|---|---|---|
|
|
| `LITELLM_URL` | `http://192.168.1.200:4000/...` | Endpoint LiteLLM |
|
|
| `HERMES_MODEL` | `hermes-default` | Modèle LiteLLM |
|
|
| `WHISPER_SIZE` | `small` | Taille modèle Whisper |
|
|
| `VOICE_THRESH` | `0.012` | Seuil RMS détection voix |
|
|
| `SILENCE_SEC` | `1.5` | Délai silence pour terminer |
|
|
| `KEYWORD` | `hermes` | Mot-clé déclencheur |
|
|
| `KEYWORD_POS` | `5` | Position max du mot-clé |
|
|
| `PIPER_VOICE` | `~/.local/share/piper/fr_FR-upmc-medium.onnx` | Voix TTS |
|
|
|
|
## Dépannage
|
|
|
|
**Port 4000 inaccessible** : ouvrir un tunnel SSH temporaire
|
|
```bash
|
|
ssh -L 4000:localhost:4000 user@192.168.1.200
|
|
# puis changer LITELLM_URL → http://localhost:4000/...
|
|
```
|
|
|
|
**libpiper_phonemize.so introuvable** : tous les `.so` de piper doivent être dans
|
|
`~/.local/share/piper-runtime/` (le script gère `LD_LIBRARY_PATH` automatiquement).
|
|
|
|
**Whisper ne comprend pas** : parler plus lentement, augmenter `WHISPER_SIZE` → `medium`.
|
|
Ou baisser `VOICE_THRESH` si le micro est peu sensible.
|
|
|
|
**Faux positifs VAD** (bruit ambiant déclenche) : augmenter `VOICE_THRESH` (ex: `0.02`).
|