Repository navigation
perf(dictation): pre-encode pause-separated chunks during long captures - #3077
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-encode completed pause-separated chunks offline during long dictations so release only decodes the final tail.
Before
When Live Text is off, PR #3057 stopped running Unified English's punctuation-dropping live stream. Short dictations got faster, but long 30–84 s dictations waited until key-up to decode the entire clip in one offline pass (~377–487 ms).
After
While a dictation records without a live stream,
PauseChunkswatches the resampled 16 kHz audio throughPauseSegmenter::for_dictation()(≥10 s piece + ≥400 ms pause, or ≥18 s + ≥300 ms).source=offlinepath.TranscriptionEnginethread (bounded to 2 in-flight chunks) while capture continues.finish_with_chunksverifies contiguous coverage of0..sealed_end, decodes only the final tail chunk (skipping it when Silero VAD finds no speech), and joins the trimmed pieces with single spaces (source=chunked).Esc), short-tap discard, near-silent discard, model switches,Command::Run/Reload, Labs › Words on screen terms, or any chunk error aborts in-flight chunks cleanly and falls back to full-clip offline decoding.Measured (Unified English Q8_0 on Metal, 56.7 s multi-sentence speech fixture)
offlinechunkedofflineExact string parity with synchronous pause-split offline decoding, zero word errors vs whole-clip, and closing sentence punctuation preserved.
Read:
src/transcription/engine/pause_chunks.rs,src/transcription/pause_segmenter.rs,src/transcription/engine.rs,src/dictation.rs.