stacks/index-tts: add streaming WAV endpoint (wrapper 0.2.0)
IndexTTS-2's tts.infer(stream_return=True) is a generator that yields
audio chunks per text segment as they finish, plus inter-segment
silence. Expose this via the existing POST /v1/audio/speech with a new
"stream": true field on the request body.
Wire-up:
- 44-byte WAV header emitted up front with placeholder data length
(0xFFFFFFFF) so chunks can be written before total samples are
known. Players that read until EOF (mpv, ffplay, aplay, sox,
browsers via <audio>) handle this fine.
- Each yielded chunk goes through _chunk_to_pcm_bytes(), which
handles torch tensors / numpy arrays in either int16 or float
(-1..1) form.
- 22050 Hz mono int16 — IndexTTS-2's hardcoded output shape.
Time-to-first-audio drops from full-file latency to ~one-segment
latency. Single-sentence inputs barely benefit; long passages /
multi-paragraph reads benefit a lot. Strict metadata parsers may
balk at the placeholder size — request without stream for a
closed-length WAV in that case.
INDEX_TTS_TAG bumped to v2 to force a rebuild.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user