Skip to content

Mic: auto-stop on silence (one-click dictation)#12

Merged
falkoro merged 1 commit into
masterfrom
feat/mic-auto-stop-silence
May 30, 2026
Merged

Mic: auto-stop on silence (one-click dictation)#12
falkoro merged 1 commit into
masterfrom
feat/mic-auto-stop-silence

Conversation

@falkoro
Copy link
Copy Markdown
Owner

@falkoro falkoro commented May 30, 2026

Dictation was two clicks (start → click again to stop + transcribe). This adds a Web Audio level monitor that auto-finishes once you pause, so it's one click: click Mic → speak → pause → text drops in.

  • monitorSilence() taps the mic stream via an AnalyserNode, tracks RMS, and calls the shared finishActiveDictation() after 1.2s of quiet (once speech was heard).
  • Manual Mic-to-stop click still works (shared finish path).
  • Degrades gracefully: no Web Audio → no-op; a hot/noisy mic that never goes "quiet" just falls back to the manual stop. Safety caps: no-speech 8s, max-take 30s.
  • Whisper latency measured at ~0.4s for a short clip, so no persistent server needed — the win is removing the second click + the pause, not raw transcode speed.

Verified in a real browser with a stubbed speak-then-silence stream: one click, auto-finished and transcribed with no second click.

🤖 Generated with Claude Code

Dictation was two clicks (start, then click again to stop + transcribe). Add a
Web Audio level monitor that auto-finishes once the speaker pauses, so it's a
single click: click Mic → speak → pause → text drops in. The manual Mic-to-stop
click still works, and it degrades gracefully (no Web Audio → no-op; a hot/noisy
mic just falls back to the manual stop). 1.2s silence trigger, with no-speech
(8s) and max-take (30s) safety caps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 19:46
@falkoro falkoro merged commit 7b08df2 into master May 30, 2026
@falkoro falkoro deleted the feat/mic-auto-stop-silence branch May 30, 2026 19:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Converts mic dictation from a two-click (start/stop) flow to a one-click flow by adding a Web Audio AnalyserNode-based RMS monitor that auto-finishes recording after a brief pause, while keeping the manual stop click and recorder-error paths intact via a shared finishActiveDictation() function.

Changes:

  • Add stopMonitor teardown hook on ActiveDictation and invoke it in both stopDictation() and the new finishActiveDictation() shared finish path.
  • Add monitorSilence() which polls RMS every 120 ms and triggers onDone after 1.2 s of silence post-speech, with 8 s no-speech and 30 s max-take safety caps; degrades to a no-op when Web Audio is unavailable.
  • Update the recording status copy and wire toggleDictation()'s second-click branch to the shared finish path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
frontend/actions.ts Adds stopMonitor, finishActiveDictation(), and monitorSilence(); routes manual stop and auto-stop through the shared path; updates status message.
public/actions.js Compiled JS mirror of the frontend/actions.ts changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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