Skip to content

fix(voice): speak streamed responses by paragraph - #314

Merged
johnmatthewtennant merged 9 commits into
mainfrom
jtennant/voice-paragraph-segmentation
Sep 9, 2026
Merged

fix(voice): speak streamed responses by paragraph#314
johnmatthewtennant merged 9 commits into
mainfrom
jtennant/voice-paragraph-segmentation

Conversation

@johnmatthewtennant

@johnmatthewtennant johnmatthewtennant commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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

  1. In a voice-enabled Berd session, select Apple TTS and ask the coding agent: “Reply with two prose paragraphs followed by a three-item Markdown list.” Confirm speech begins with the complete opening phrase, pauses between prose paragraphs, and speaks the list as one block rather than pausing after every item.
  2. Repeat with OpenAI TTS. Confirm the response does not speak an isolated opening letter or word and the paragraph gap sounds natural without stacking an extra pause on provider-generated silence.
  3. Repeat both backends at normal and maximum speech speed. Confirm the paragraph cadence scales with the selected rate.
  4. Select Pocket TTS and request one paragraph long enough to exceed Pocket’s model token limit followed by a short second paragraph. Confirm the long paragraph continues through its model-safe internal splits without paragraph-length pauses, then pauses once before the second paragraph.
  5. Interrupt during the second paragraph. Confirm playback stops immediately and does not resume with queued paragraphs.

@johnmatthewtennant
johnmatthewtennant marked this pull request as ready for review September 9, 2026 22:42
@johnmatthewtennant
johnmatthewtennant requested a review from a team September 9, 2026 22:42

@morgmart morgmart left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

@johnmatthewtennant
johnmatthewtennant merged commit d3b4fb8 into main Sep 9, 2026
15 of 16 checks passed
@johnmatthewtennant
johnmatthewtennant deleted the jtennant/voice-paragraph-segmentation branch September 9, 2026 23:11
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.

2 participants