fix(voice): speak streamed responses by paragraph - #314
Conversation
morgmart
left a comment
There was a problem hiding this comment.
🤖 Automated code review
Engineering review is clear. The exact three-dot comparison consistently centralizes streamed speech-block segmentation across Siri, OpenAI, and Pocket TTS, preserves provider-limit continuation semantics, accounts for inserted silence in delivery progress, and includes discriminating coverage for paragraph boundaries, Markdown lists, provider splits, quiet-padding measurement, cadence scaling, and interruption behavior. Static review found no publishable changed-line defects. Supplied GitHub checks are structurally valid and passing at capture time; required checks still govern merge readiness. Recommendation: APPROVE.
Deterministic publication result: 0 blocking and 0 non-blocking inline finding(s) publishable; 0 duplicate(s) suppressed; 0 blocking screenshot-evidence requirement(s) in this review body.
Pending checks: 1 check(s) are not complete.
This approval reflects the completed code review only; merge readiness remains governed by the repository's required checks.
Summary
Streamed voice replies could send a tiny opening fragment to speech synthesis before the rest of the response arrived, producing an isolated letter or word followed by an awkward pause. Berd Voice holds incomplete text until a paragraph boundary and owns segmentation for Siri, OpenAI, and Pocket TTS. Adjacent Markdown list items stay in one speech block, while Pocket can still split a paragraph that exceeds its model token limit without treating those provider-safe pieces as separate paragraphs.
Paragraph transitions also preserve natural cadence at the selected speech rate. Siri uses a rate-adjusted pause. OpenAI measures quiet padding already present in the synthesized PCM and adds only the missing silence, including when that padding contains quiet nonzero samples rather than literal zeros.
Reviewer-reproducible examples