feat(tts): default to offline GPU MeloTTS with brain-role worker

Switch the default TTS engine from online Edge TTS to offline GPU
MeloTTS (privacy-first: reply text never leaves the host). Adds a
supervisord melo-worker program that runs in full/bot/brain roles and
synthesises Korean on the GPU (MELO_DEVICE=cuda, MELO_SPEED=1.5), a
baked /opt/melo py3.11 venv layer in the Dockerfile, and compose/env
defaults. Edge TTS stays available as an opt-in online fallback via
TTS_ENGINE=edge.

Verified on the RTX 5050 (Blackwell sm_120): melo-worker logs
"ready (lang=KR speed=1.5 device=cuda)", /health returns ok, and a
/synth round-trip returns a 177KB WAV.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-07-22 20:39:54 +09:00
parent 8562548571
commit bb60c4db3b
5 changed files with 65 additions and 20 deletions

View File

@@ -87,11 +87,17 @@ services:
WHISPER_DEVICE: ${WHISPER_DEVICE:-cuda}
WHISPER_COMPUTE_TYPE: ${WHISPER_COMPUTE_TYPE:-float16}
# TTS engine. Rendered into /app/config/jarvis.json via envsubst (the
# bridge reads that JSON BEFORE the env, so it must carry the real engine,
# not a hardcoded one — otherwise Korean text is read by the English Piper
# voice). Default edge; .env can override (e.g. piper for offline).
TTS_ENGINE: ${TTS_ENGINE:-edge}
# Edge TTS voice + rate (the chosen natural Korean voice). NOTE: edge is an
# bridge reads that JSON BEFORE the env, so it must carry the real engine).
# Default melo: GPU MeloTTS (offline, privacy-first) via the melo-worker.
# Override with TTS_ENGINE=edge for the online Microsoft neural voice (text
# leaves the host) or piper for the offline English voice.
TTS_ENGINE: ${TTS_ENGINE:-melo}
# GPU MeloTTS worker knobs. MELO_DEVICE=cuda runs synth on the GPU (next to
# Ollama + Whisper); cpu is the no-GPU fallback. MELO_SPEED must always be
# set — supervisord's melo-worker expands %(ENV_MELO_SPEED)s at startup.
MELO_DEVICE: ${MELO_DEVICE:-cuda}
MELO_SPEED: ${MELO_SPEED:-1.5}
# Edge TTS voice + rate (used only when TTS_ENGINE=edge). NOTE: edge is an
# ONLINE engine — reply text is sent to Microsoft and needs internet.
EDGE_TTS_VOICE: ${EDGE_TTS_VOICE:-ko-KR-HyunsuMultilingualNeural}
EDGE_TTS_RATE: ${EDGE_TTS_RATE:-+45%}