An Android overlay that captures permitted playback audio, streams ordered PCM frames to an authenticated local worker, and turns finalized German speech into translated captions and reusable vocabulary cards.
Language learners watching German media need captions and vocabulary without routing microphone audio through a cloud service. Playback capture, speech segmentation, inference backpressure, ordered delivery, overlay permissions, and local-network trust all have to work together.
Implemented solution
The Android 10+ client captures 16 kHz mono playback audio, sends framed PCM over an authenticated WebSocket, and renders finalized caption and vocabulary events in an overlay that also supports Samsung DeX. A Python worker uses WebRTC voice activity detection, an ordered utterance queue, Faster Whisper, translation, and deterministic vocabulary selection.
Outcome
A debug APK was assembled, five Android tests passed, and all six isolated Python worker tests passed. The implementation preserves utterance order under inference pressure, rejects invalid frames and non-speech, deduplicates vocabulary, exposes explicit stop controls, and never requests microphone permission.
Technical and operational context
The project connects Android media APIs, Kotlin service lifecycle, a binary streaming protocol, Python asynchronous processing, speech inference, backpressure, local-network security, systemd operation, and user-facing recovery controls in one end-to-end product.
Constraints
Android can capture only applications that permit playback capture; DRM-protected or opted-out media remains unavailable.
The worker is designed for an operator-controlled local machine rather than an Internet-facing multi-tenant service.
Inference latency depends on worker hardware, model size, and utterance length.
Release builds reject cleartext traffic; debug builds may use cleartext WebSockets only for local development.
Architecture
Permitted Android playback capture produces fixed 20 ms PCM frames. An authenticated WebSocket carries a versioned hello message and binary audio to a local worker. Voice activity detection finalizes utterances, the worker transcribes and translates them in order, and the client binds captions and vocabulary to the same utterance identifier.
Android playback capture
20 ms PCM frames
Authenticated WebSocket
Voice activity detection
Ordered Whisper inference
Caption and translation event
Vocabulary overlay and CSV export
Architecture visual
The implemented local-first audio and caption path, including the consent, backpressure, and operator-controlled worker boundaries.
The Android 10+ client captures 16 kHz mono playback audio, sends framed PCM over an authenticated WebSocket, and renders finalized caption and vocabulary events in an overlay that also supports Samsung DeX. A Python worker uses WebRTC voice activity detection, an ordered utterance queue, Faster Whisper, translation, and deterministic vocabulary selection.
Captures playback audio without requesting microphone permission
Applies TCP/WebSocket backpressure and processes finalized utterances in order
Uses two-stage non-speech filtering before publishing captions
Associates captions and vocabulary through deterministic utterance identifiers
Capturing application playback keeps room noise and microphone permission out of the path. The trade-off is that Android and the source application must explicitly permit capture.
Utterance queue instead of independent chunks
Voice activity detection and ordered processing preserve sentence boundaries and prevent busy inference from silently dropping audio. Backpressure can increase latency when the worker is undersized.
Local worker instead of mandatory cloud inference
A paired worker keeps audio on an operator-controlled network and makes model choice explicit. The operator must secure the listener, token, firewall, and TLS boundary.
Security, reliability, and observability
Authenticated protocol
The worker requires a generated pairing token and compares it using a constant-time check before accepting streaming audio.
Bounded client state
The Android app retains up to 500 deduplicated vocabulary items and exposes stop controls from both the application and foreground-service notification.
Hardened worker service
Installation creates a dedicated environment and systemd user service; WSS certificate paths and network binding remain explicit operator configuration.
Checks shown here are project-specific; no portfolio-wide claim is applied automatically.
A fresh offline Gradle run recorded 5 Android tests passed on 24 July 2026
A fresh offline Gradle run assembled the Android debug APK on 24 July 2026
A fresh Python 3.14 run passed 6 worker tests for segmentation, non-speech rejection, frame validation, overlap handling, and vocabulary selection
Android manifest requests playback capture and overlay capabilities without microphone permission
The retired sentence-dropping endpoint returns HTTP 410 instead of silently accepting the obsolete protocol
Evidence and links
Links are limited to public-safe source material and sanitized evidence. Credentials, state, plans, identifiers, private topology, and backup contents are intentionally excluded.