Skip to content

Improve recording startup responsiveness and language feedback#20

Draft
aladin7 wants to merge 1 commit into
benmaster82:mainfrom
aladin7:agent/reduce-recording-start-latency
Draft

Improve recording startup responsiveness and language feedback#20
aladin7 wants to merge 1 commit into
benmaster82:mainfrom
aladin7:agent/reduce-recording-start-latency

Conversation

@aladin7

@aladin7 aladin7 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What changed

  • prepare and reuse a stopped microphone stream so recording startup avoids repeated device enumeration while keeping capture inactive when idle
  • keep pynput responsive by dispatching recording callbacks through an ordered worker, preserving key-release events during slow device startup
  • move recording-state UI work onto the Tk thread, guard stale first-audio events, and fully hide the overlay after short taps
  • make shutdown cancel in-progress startup and terminate Tk, hotkey, tray, scheduler, and microphone resources safely
  • show Auto or fixed recognition language in the listening overlay and offer the first detected language as a persistent selection
  • retain the compact language list in Settings while supporting every language recognized by faster-whisper
  • log whether language detection is enabled or a fixed language is being used

Why

Opening the microphone from scratch for every recording made the listening indicator and first audio inconsistent on Windows. Slow startup also blocked pynput's event callback, which could delay or lose the corresponding key release. Tk operations were scheduled from background threads, allowing the recording-to-transcription handoff or shutdown to stall.

Automatic language recognition was also opaque: users could not see whether detection was active, what Whisper detected, or choose the detected language without navigating Settings.

Impact

Recording feedback now appears immediately, actual Listening state begins with the first audio frame, and release events are processed reliably. The microphone remains stopped while idle, avoiding a persistent Windows microphone indicator on the tested system. Short taps leave no residual overlay, and quitting releases the process cleanly.

Users in Auto mode can see the detected language and choose whether to fix recognition to it. Once fixed, subsequent transcriptions skip automatic detection.

Validation

  • python -m unittest discover -q (69 tests)
  • python -m compileall -q .
  • git diff --check
  • manual Windows checks for idle microphone privacy indicator, first-use wake delay, repeated hold/release dictation, short taps, language prompt behavior, and tray shutdown

@benmaster82

Copy link
Copy Markdown
Owner

Impressive work again ,the prepared-stream approach and the ordered callback dispatch address real latency issues, and the language feedback in the overlay is a nice touch. Two things before we can merge: (1) the branch is based on a pre-#18 main and conflicts with the shutdown redesign that was just merged ,could you rebase onto current main and reconcile the two shutdown paths? (2) Keeping the mic stream open while idle: have you checked the impact on Bluetooth headsets (HFP low-quality profile staying engaged) and on the Windows 11 mic privacy indicator? If either misbehaves, we may want to close the stream after N seconds of inactivity. Happy to merge once rebased.

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