From b252c39517b9fce181d1a0fe4761404c7d981397 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 18 Aug 2026 23:18:37 +0200 Subject: feat: local TTS via piper subprocess with Google fallback - New src/tts.rs: centralize TTS in synthesize(config, http_client, text) Piper subprocess primary, Google Translate fallback on error/missing - TTS_MODEL_PATH/TTS_VOICE env config (defaults to pl_PL-bass-high) - Fix Unknown interaction errors: spawn play_tts_in_channel in background so voice-state TTS no longer blocks the shard event loop (3s Discord limit) - Best-effort confirmation replies in /tts to prevent error cascade - Custom on_error handler: graceful interaction-expired error handling - Comprehensive tracing logging (engine, model, duration, stderr) --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9b1fea9..55ca02d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ The following binaries must be available on `PATH`: - `ffmpeg` — audio decoding/encoding for playback, conversion, and compression - `qalc` (Qalculate) — used by `/math` to evaluate expressions - `yt-dlp` (optional) — used by `/download` +- `piper` (optional) — local TTS for `/tts` and `/senator ... tts_vc`; falls back to Google Translate TTS if unavailable Unlike the Python version, QR encode/decode is handled by the pure-Rust `qrcode`/`rxing` crates — no `zbar` system library required. @@ -44,6 +45,11 @@ On launch, missing variables are reported via tracing (`error!` for required, `warn!` for optional with defaults). The database and schema migrations are created automatically on first run. +For local TTS, set `TTS_MODEL_PATH` to a Piper `.onnx` model file (or a +directory of models, in which case `TTS_VOICE` selects the model, defaulting to +`pl_PL-bass-high`). When `TTS_MODEL_PATH` is unset or Piper is unavailable, the +bot falls back to Google Translate TTS. + ### 5. Run ```bash @@ -65,7 +71,7 @@ servers. - `/join` — join the caller's voice channel ### TTS -- `/tts` — Google Translate TTS (Polish), sent as a file or played in voice +- `/tts` — local Piper TTS (Polish, Google Translate fallback), sent as a file or played in voice ### Search & Web - `/web` — DuckDuckGo HTML scrape (soon to use 4get) -- cgit v1.2.3