Skip to content

Streaming: cap the pauses a dictation stream's native stream hears - #338

Closed
ElliottH wants to merge 3 commits into
anomalyco:devfrom
ElliottH:stream-silence-trim-pr
Closed

ElliottH wants to merge 3 commits into
anomalyco:devfrom
ElliottH:stream-silence-trim-pr

Conversation

@ElliottH

@ElliottH ElliottH commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the dropped-word defect recorded in #324: after a pause longer than Parakeet Unified English's 5.6 s left context, the buffered stream can drop the next sentence's first word, for example "successfully. I now" becoming "successfully now". The paste keeps the loss, because a stream that produced text is never retranscribed. NeMo's reference buffered streaming does the same on the same audio. The full investigation is in #324 and the feature map.

The engine now caps the pauses a dictation stream's native stream hears. PauseCap in transcription_engine.rs wraps the stream in drive_stream.

  • What it drops: in a run of 20 ms frames that meetings' pause_segmenter::SpeechFrames calls not speech, the native stream gets the first 2.5 s and the last 0.3 s. The middle is dropped. The 0.3 s tail is held back and released just before speech resumes.
  • Why 2.5 s: the head outlasts a chunk plus its lookahead (2.08 s), so the words before a pause are decoded, and shown as live text, during it. A 1.7 s head left the last word before a pause unshown until speech resumed.
  • Short pauses: until a pause passes 2.5 s, every sample goes straight through, so live text and tiny feeds behave exactly as before.
  • Unchanged: the capture, the clip, fed (still counted in clip samples), the finish's remainder and the overfed, empty and failed fallbacks, LiveStream, and the macOS, Linux and Windows capture loops.
  • Only dictation streams: /streams (drive_yielding) is untouched.
  • Off switch: HEX_STREAM_PAUSES=0 turns it off.
  • Logging: "finished live stream" gains a pauses_dropped_ms field.

Limits: speech within 12 dB of the room counts as pause. SpeechFrames' noise floor rises only about 3 dB a second, so room noise that gets louder mid-dictation counts as speech for up to about 10 s, and that pause isn't capped. In that case the dictation behaves exactly as today; it can't get worse.

Test plan

  • scripts/check on macOS: 1,837 tests. This needs fix(tests): give mouse_hotkeys the capture shortcut fields #337, which fixes dev's test build; until it merges, this PR's test build fails the same way dev does. New tests:

    • speech_and_pauses_under_two_seconds_reach_the_stream_whole: speech, whispers, and pauses under 2 s are bit-identical, over quiet and −40 dBFS rooms.
    • long_pauses_reach_the_stream_capped_with_their_ends: digital silence, a −50 dBFS floor, and a −40 dBFS room are capped exactly, and a trailing pause keeps only its head.
    • a_dictation_stream_hears_long_pauses_capped_and_finishes_with_the_clip: through drive_stream, the finish feeds the remainder and the clip is unchanged.
  • Real model on Metal (M3 Pro, Unified English Q8), via metal_stream_tracks_offline_transcription with the new HEX_STREAM_LEADS_MS, every result from the stream:

    Gap Kind Before After
    6–14 s digital silence 18/36 0/36
    6–14 s −50 dBFS noise throughout 18/36 0/36
    6–14 s noise only in the gap (the floor limit) 18/36 18/36
    2–4 s every kind 0/24 0/24

    Rerun with the 2.5 s head: digital silence and noise throughout, 2–14 s gaps, 0/88, every result from the stream.

  • A recorded physical-microphone dictation (a 10 s pause), replayed on Metal:

    • The word before the pause: with a 1.7 s head it appeared at 21.3 s, after speech resumed. With 2.5 s it appeared at 12.5 s, during the pause.
    • The final text: with the cap, 0/24 words different. Uncapped, 1/24: the original bug.
  • By hand in Hex Test.app with a physical microphone, with the 1.7 s head: five dictations with 10–18 s pauses all kept the second sentence's first word.

    • The stream skipped 10.1–18.5 s of pause each time.
    • Every result came from the stream, with release-to-text of 96–196 ms.
  • Not verified: Linux and Windows builds (the change is shared engine code, compiled only on macOS), Vulkan, and real rooms beyond one.

🤖 Generated with Claude Code

The defect recorded in anomalyco#324: Parakeet's buffered streaming drops the
first word after a pause longer than its 5.6 s left context, and the
paste keeps the loss. The engine now feeds the native stream only the
first 1.7 s and last 0.3 s of each pause (20 ms frames that
pause_segmenter's SpeechFrames calls not speech), in drive_stream's feed
path and the finish's remainder. The capture, the clip, `fed`, live text,
and the fallbacks are unchanged; /streams is untouched.
HEX_STREAM_PAUSES=0 turns it off. See anomalyco#324 and the feature map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ElliottH
ElliottH marked this pull request as draft October 29, 2026 02:39
A 1.7 s head is shorter than a chunk and its lookahead (2.08 s), so the
word before a long pause could stay undecoded, and missing from the live
text, until speech resumed. A recorded dictation replayed on Metal showed
it at 21.3 s with 1.7 s and at 12.5 s, during the pause, with 2.5 s; the
synthetic sweep stays at 0 drops (0/88).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ElliottH
ElliottH marked this pull request as ready for review October 29, 2026 02:56
thdxr added a commit that referenced this pull request Oct 29, 2026
…) (#367)

A buffered Parakeet stream can drop the first word after a pause longer
than its 5.6 s left context (#324). The engine now feeds a dictation
stream only the first 2.5 s and last 0.3 s of each pause; the clip and
its offline fallback are unchanged.

Co-authored-by: ElliottH <[email protected]>
@thdxr

thdxr commented Oct 29, 2026

Copy link
Copy Markdown
Member

Thank you, @ElliottH, for a really thorough diagnosis! The investigation in #324 and the measurements here made the fix straightforward. Hex now writes all of its changes in-house, so we're closing outside pull requests. The fix landed in #367 with credit to you (Co-authored-by): a dictation stream now hears only the first 2.5 s and last 0.3 s of each pause, using your analysis. Issues with diagnoses like this one are always welcome.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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