mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1138] TTS: stream audio per sentence as the model generates (drop time-to-first-audio) #562
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#562
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @etherious1804 on GitHub (May 24, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1138
Problem
When auto-play is enabled, Marinara dispatches the entire model reply to TTS only after
isStreamingflips to false — i.e. after the full reply has been generated AND any post-processing agents have run. For local TTS providers (mlx-audio, openedai-speech, etc.) where synthesis is much slower than cloud APIs, this means the user waits the full reply time before hearing the first word. With a 30-second roleplay reply and a local Chatterbox model, time-to-first-audio is 30+ seconds.The information needed to start TTS earlier is already available in the chat store:
streamBuffersis updated token-by-token as the LLM streams. We can split on sentence boundaries and dispatch each completed sentence to/api/tts/speakimmediately, playing the resulting clips sequentially as they arrive.Proposed feature
Opt-in toggle under TTS settings: "Stream as the model generates". When enabled (with auto-play for the chat mode also enabled):
UX edge cases
<thought>,<|channel>thought) — recognized and skipped so the model's reasoning isn't spoken aloud.content_replaceevents — defensive cursor snap so a shortened buffer doesn't desync the chunker.ttsService.stop(), preserving the global service for other code paths.playbackRateis applied client-side on each audio element so the slider works regardless of whether the local TTS server respects thespeedAPI parameter.Implementation
Open PR follows.
@cha1latte commented on GitHub (May 25, 2026):
Triage note: labeling this as
normal-scopebecause streaming TTS is an aligned opt-in improvement for existing TTS autoplay behavior with clear user-facing edge cases and a bounded settings toggle.The least risky next step is to review the open implementation against stop/cancel, chat-switch, and duplicate-playback boundaries.