perf(tts): piper in-process mit gecachtem Modell statt Subprozess pro Satz

Profiling zeigte ~2,2 s Fixkosten pro Satz durch Modell-Start (piper-Binary je
Aufruf). Der Provider nutzt jetzt die piper-Python-API: Stimmmodell wird einmal
geladen (lru_cache), Synthese laeuft im Thread. Resampling in-process (audioop,
numpy-Fallback fuer Py3.13) statt ffmpeg-Subprozess. Binary bleibt als Fallback.

Messung (lokales Setup): erster Ton 5,84 s -> 2,66 s, Turn-Ende 9,82 s -> 4,04 s.

- pyproject: piper-tts zum [local]-Extra
- Tests pruefen weiter den Binary-Fallback (erzwingen _PIPER_LIB=False)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-06-18 08:22:04 +02:00
commit 7ca69e1049
3 changed files with 83 additions and 48 deletions

View file

@ -17,9 +17,11 @@ dependencies = [
test = [
"pytest>=8.0"
]
# Lokale KI-Module (optional, schwergewichtig): lokales STT via faster-whisper.
# Lokale KI-Module (optional, schwergewichtig): lokales STT via faster-whisper,
# lokales TTS via piper (in-process -> Modell bleibt geladen, kein Start pro Satz).
local = [
"faster-whisper>=1.0"
"faster-whisper>=1.0",
"piper-tts>=1.2"
]
[build-system]