Mic: auto-stop on silence (one-click dictation)#12
Merged
Conversation
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>
There was a problem hiding this comment.
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
stopMonitorteardown hook onActiveDictationand invoke it in bothstopDictation()and the newfinishActiveDictation()shared finish path. - Add
monitorSilence()which polls RMS every 120 ms and triggersonDoneafter 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.
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.
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 anAnalyserNode, tracks RMS, and calls the sharedfinishActiveDictation()after 1.2s of quiet (once speech was heard).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