Streaming sentence-level playback from live chunks #19

Open
opened 2026-10-25 14:58:45 +00:00 by dsh · 0 comments
Owner

Goal

Start speaking before the turn ends: synthesize sentence by sentence from the live stream, without double-speaking when the durable message settles.

Scope

  • Use assistant/live-chunk (event.data.chunk.type === 'text') to accumulate a buffer; flush on sentence boundaries through the chunker.
  • Deduplicate against the assistant/message settlement (#5): speak a sentence once, never replay the settled text.
  • Barge-in: a new user message or stop clears pending work.
  • Latency budget: first audio < 1.5 s after the first sentence of a typical reply; measure and record.
  • Feature flag streaming: true|false default false until the measured path is stable.
  • Unit-test the buffer/flush logic with a synthetic chunk sequence (partial words, split sentences, code blocks).

Acceptance

  • Streaming and non-streaming produce identical audio content for the same reply.
  • No sentence is spoken twice; cancelling stops within ~100 ms.
  • Latency numbers recorded on the issue.

Notes

  • Depends on #5, #6, #7. Part of M4. Risk: TextSplitterStream-style bugs on newline tokens; tests must cover markdown fences.
## Goal Start speaking before the turn ends: synthesize sentence by sentence from the live stream, without double-speaking when the durable message settles. ## Scope - [ ] Use `assistant/live-chunk` (`event.data.chunk.type === 'text'`) to accumulate a buffer; flush on sentence boundaries through the chunker. - [ ] Deduplicate against the `assistant/message` settlement (#5): speak a sentence once, never replay the settled text. - [ ] Barge-in: a new user message or `stop` clears pending work. - [ ] Latency budget: first audio < 1.5 s after the first sentence of a typical reply; measure and record. - [ ] Feature flag `streaming: true|false` default false until the measured path is stable. - [ ] Unit-test the buffer/flush logic with a synthetic chunk sequence (partial words, split sentences, code blocks). ## Acceptance - Streaming and non-streaming produce identical audio content for the same reply. - No sentence is spoken twice; cancelling stops within ~100 ms. - Latency numbers recorded on the issue. ## Notes - Depends on #5, #6, #7. Part of M4. Risk: `TextSplitterStream`-style bugs on newline tokens; tests must cover markdown fences.
Sign in to join this conversation.
No description provided.