Skip to content

Keep a pre-roll buffer so fast-spoken requests aren't clipped after the wake word #30

Description

@jamditis

Problem

stream_detect_wake consumes every frame up to and including the frame where the wake score crosses threshold, and run_turn then starts capture_request from only the remaining iterator. The wake score crosses with some detection latency, so when the user speaks the request with little or no pause after the wake phrase, the first fraction of the request can be consumed during detection and never reaches whisper — clipping the start of the command.

Raised by the cloud Codex review on PR #29 (pipeline.py around the stream_detect_wake -> capture_request handoff).

Fix

Keep a small pre-roll ring buffer of the most recent frames in stream_detect_wake and include it at the front of the captured request, so the audio just before the trigger is preserved.

Why deferred from PR #29

The right pre-roll size depends on the actual wake-detection latency for the "computah" model on the PowerConf mic, which is hardware tuning this PR explicitly leaves for the live mic work (#9/#10). Sizing it against synthetic audio would be a guess. Do this with real capture, alongside or after #9.

Acceptance

  • A request spoken immediately after the wake word transcribes in full (no clipped leading word).
  • Pre-roll length is a named constant, tuned against real mic latency, with a test that a no-pause wake+request keeps its first word.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions