diff --git a/stacks/index-tts/.env.example b/stacks/index-tts/.env.example index ac7b338..480bb3f 100644 --- a/stacks/index-tts/.env.example +++ b/stacks/index-tts/.env.example @@ -6,8 +6,9 @@ INDEX_TTS_SHA=830f6f8f94a51fea23ab1d639027a86200075a4e # Local image tag — bump when you change build context (Dockerfile, -# app.py, entrypoint.sh) to force a fresh layer build. -INDEX_TTS_TAG=v1 +# app.py, entrypoint.sh) to force a fresh layer build. v2 = wrapper +# 0.2.0 with the streaming endpoint. +INDEX_TTS_TAG=v2 # ── network ────────────────────────────────────────────────────────── # Host port. Container listens on 8000 internally. diff --git a/stacks/index-tts/README.md b/stacks/index-tts/README.md index 688f583..ee59358 100644 --- a/stacks/index-tts/README.md +++ b/stacks/index-tts/README.md @@ -72,9 +72,39 @@ curl -X POST http://10.100.79.3:8192/v1/audio/speech \ curl http://10.100.79.3:8192/healthz ``` -Output is always WAV (PCM_16, 22050 Hz — IndexTTS-2's native rate). +Output is always WAV (PCM_16, 22050 Hz mono — IndexTTS-2's native rate). `response_format` other than `wav` is rejected. +### Streaming (since 0.2.0) + +Add `"stream": true` to any request to stream the WAV as it generates. +IndexTTS-2 emits one chunk per text segment (~120 tokens) as soon as it +finishes synthesizing it; long inputs start playing while the rest is +still being generated. + +```bash +# Pipe straight into a player. Time-to-first-audio drops from +# whole-file latency to ~one-segment latency. +curl -fsS -X POST http://10.100.79.3:8192/v1/audio/speech \ + -H 'Content-Type: application/json' \ + -d '{"input":"long passage of text...","voice":"glados","stream":true}' \ + | mpv --no-cache - + +# Or save while playing (tee). +curl -fsS -X POST http://10.100.79.3:8192/v1/audio/speech \ + -H 'Content-Type: application/json' \ + -d '{"input":"...","voice":"glados","stream":true}' \ + | tee out.wav | mpv - +``` + +The streaming WAV uses a placeholder data-length in the header +(`0xFFFFFFFF`) so chunks can be written before the total is known. +Players that read until EOF (mpv, ffplay, aplay, sox, browsers via +`