Skip to content

feat: stream MLX TTS audio chunks - #804

Draft
nwalker85 wants to merge 2 commits into
jamiepine:mainfrom
nwalker85:codex/live-audio-streaming
Draft

feat: stream MLX TTS audio chunks#804
nwalker85 wants to merge 2 commits into
jamiepine:mainfrom
nwalker85:codex/live-audio-streaming

Conversation

@nwalker85

@nwalker85 nwalker85 commented Jun 26, 2026

Copy link
Copy Markdown

Status

Draft/WIP. This has passed focused unit and syntax checks, but has not yet been tested against a real loaded MLX TTS model for time-to-first-audio or playback behavior. It should not be treated as ready for review until that real-model streaming test is done.

Summary

  • expose MLX model generation as an async chunk stream instead of collecting the full waveform first
  • make /generate/stream emit a WAV header plus PCM16 chunks for live-compatible requests
  • keep the existing buffered fallback when normalization, effects, trim, or crossfade require whole-file processing, and label responses with X-Voicebox-Stream-Mode
  • document the live streaming contract and add focused unit tests for the streaming helpers

Validation

  • uv run --with pytest --with pytest-asyncio --with soundfile --with librosa --with numpy python -m pytest tests/test_streaming_audio.py
  • uvx ruff check --select F,I,RUF100 backends/mlx_backend.py utils/audio.py utils/chunked_tts.py routes/generations.py tests/test_streaming_audio.py
  • python -m compileall backends/mlx_backend.py utils/audio.py utils/chunked_tts.py routes/generations.py

Still needed

  • run against a real Voicebox profile/model locally
  • measure time-to-first-audio on /generate/stream with normalize: false
  • verify browser/client playback and lip-sync analyser behavior

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d15aef7a-298e-46eb-99c3-ba76c0341601

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant