Skip to content

feat(voice): chunked TTS playback for long text#16

Merged
DannyNs merged 1 commit intomainfrom
feature/voice-chunked-tts-playback
Mar 18, 2026
Merged

feat(voice): chunked TTS playback for long text#16
DannyNs merged 1 commit intomainfrom
feature/voice-chunked-tts-playback

Conversation

@DannyNs
Copy link
Collaborator

@DannyNs DannyNs commented Mar 18, 2026

Summary

  • Split long TTS text into rolling chunks of 2-3 sentences (~150 chars each)
  • Pipeline generation + playback: first chunk plays almost immediately while next generates in background
  • Configurable chunk threshold (default 100 chars) via dashboard UI and config
  • voice_stop cancels instantly between chunks via stop flag
  • Falls back gracefully: chunked → single-shot edge-tts → platform native TTS

Reference

Inspired by dyoburon/vibetotext#9 (Python implementation)

Changes

  • src/apps/voice/src/services/tts.tssplitSentences(), groupChunks(), playMp3Blocking(), speakChunked() + updated speak() and stop()
  • src/apps/voice/src/services/config-store.ts — Added chunkThreshold to TtsConfig
  • src/apps/voice/public/page.js — "Chunk Threshold (chars)" field in dashboard TTS settings

Test plan

  • Short text (<100 chars): verify single-shot playback unchanged
  • Long text (500+ chars): verify first chunk starts playing within seconds, seamless transitions between chunks
  • voice_stop during chunked playback: verify immediate cancellation
  • Set chunk threshold to 0 in dashboard: verify all text goes through chunked path
  • Set chunk threshold to 5000: verify long text falls back to single-shot
  • Verify temp chunk files are cleaned up after playback completes

🤖 Generated with Claude Code

Split long text into rolling chunks of 2-3 sentences and pipeline
generation + playback so the first chunk plays almost immediately
while subsequent chunks generate in the background.

Reference: dyoburon/vibetotext#9
@DannyNs DannyNs merged commit 59427cf into main Mar 18, 2026
1 check passed
@DannyNs DannyNs deleted the feature/voice-chunked-tts-playback branch March 18, 2026 23:19
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