Skip to content

feat: reliable mobile recording (wake lock + Whisper anti-hallucination) - #18

Merged
Endika merged 12 commits into
mainfrom
feat/reliable-mobile-recording
Jun 4, 2026
Merged

feat: reliable mobile recording (wake lock + Whisper anti-hallucination)#18
Endika merged 12 commits into
mainfrom
feat/reliable-mobile-recording

Conversation

@Endika

@Endika Endika commented Jun 4, 2026

Copy link
Copy Markdown
Owner

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)

  • New ScreenWakePort + WakeLockAdapter (re-acquires on visibilitychange, no-ops when unsupported).
  • Auto-acquired while recording, released on pause/stop and on leaving the page; a toggle button overrides it (persisted as keepScreenAwake, default on).

2. Anti-hallucination (3 layers)

  • Skip silence at source: MediaRecorderAdapter measures per-chunk peakLevel via an AnalyserNode; TranscribeChunkUseCase skips near-silent chunks (ok(null)) so Whisper is never called on silence (no hallucination, no wasted cost).
  • Confidence filter (Whisper-specific): WhisperClient parses verbose_json segments and drops non-speech ones by no_speech_prob/avg_logprob.
  • Blocklist (provider-agnostic): HallucinationFilter strips known credit/sign-off/tag phrases; single-word tags (music/applause) match whole-line only so real speech mentioning them is kept.
  • New skipped HUD counter distinguishes silent/non-speech from real failures (EN/ES/EU).

Quality

  • TDD throughout; in-memory fakes, no mocks. Full gate green: lint + typecheck + 129 tests + build.
  • Includes fixes from an adversarial code review: stop peak-sampling on pause (battery), release wake lock on dispose (leak), and guard the silence gate when AudioContext is 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).

@Endika
Endika merged commit 2b550ab into main Jun 4, 2026
2 checks passed
@Endika
Endika deleted the feat/reliable-mobile-recording branch June 4, 2026 15:58
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.

1 participant