feat: reliable mobile recording (wake lock + Whisper anti-hallucination) - #18
Merged
Conversation
This was referenced Jun 4, 2026
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.
Makes recording reliable on phones: keeps the screen awake while recording and stops Whisper's silence-hallucinations (the repeated "Subtítulos realizados por la comunidad de Amara.org") from polluting the transcript.
Spec & plan:
mintza-notes/2026-06-04-reliable-mobile-recording-{design,plan}.md(outside the repo).What changed
1. Screen Wake Lock (auto + override)
ScreenWakePort+WakeLockAdapter(re-acquires onvisibilitychange, no-ops when unsupported).keepScreenAwake, default on).2. Anti-hallucination (3 layers)
MediaRecorderAdaptermeasures per-chunkpeakLevelvia anAnalyserNode;TranscribeChunkUseCaseskips near-silent chunks (ok(null)) so Whisper is never called on silence (no hallucination, no wasted cost).WhisperClientparsesverbose_jsonsegments and drops non-speech ones byno_speech_prob/avg_logprob.HallucinationFilterstrips known credit/sign-off/tag phrases; single-word tags (music/applause) match whole-line only so real speech mentioning them is kept.skippedHUD counter distinguishes silent/non-speech from real failures (EN/ES/EU).Quality
AudioContextis unavailable.Needs real-device verification
Web Audio peak metering, the Wake Lock API, and the mobile recording/pause flow can't be exercised headless — please smoke-test on a phone (record with the screen lock, confirm no Amara lines, check the toggle).