Most online audio transcription tools follow the exact same architecture: upload a 50 MB WAV or MP3 file to someone else's server, wait in a queue, and hope your private interview or meeting recording actually gets deleted afterward.
While building AIAC, we kept hearing the same hesitation from journalists, podcasters, and musicians: "I want fast speech-to-text and audio analysis, but I can't upload unreleased mixes or confidential client interviews."
So we shipped a dual-engine architecture where Whisper speech-to-text, loudness metering, spectral analysis, and a Rust/WASM multitrack DAW all run 100% locally in the browser—while still offering an optional cloud path for heavier summarization and multi-tab notes.
1. Architecture: Web Worker + Cache API + WebGPU/WASM Fallback
Running an inference model on the main UI thread freezes scrolling and audio playback instantly. Our local transcription pipeline isolates everything inside a dedicated module Worker:
-
Zero server upload: Audio is decoded directly in the browser via
AudioContext.decodeAudioDataand resampled to 16 kHz monoFloat32Array. -
Model persistence: Quantized Whisper weights (
Tiny ~39 MBorBase ~73 MB) are fetched once and cached locally in the browser Cache API. -
Automatic hardware selection: If
navigator.gpuis available and initializes cleanly, inference runs on WebGPU; otherwise it falls back cleanly to WASM SIMD without crashing Safari or older laptops.
Observed Latency (Apple Silicon Chrome)
| Run Type | Model | Wall Time (15s Speech Clip) | Server Bytes Uploaded |
|---|---|---|---|
| Cold first load (download + init + infer) | Whisper Tiny | ~24s | 0 bytes |
| Warm cached run | Whisper Tiny | ~2.7s | 0 bytes |
Once the weights sit in local cache, offline mode works even if you disconnect Wi-Fi.
2. CSP Gotchas When Hosting Local WebGPU/WASM Models
One thing that catches teams off guard when deploying browser AI tools on strict Content-Security-Policy headers:
-
script-srcneeds'wasm-unsafe-eval'(never full'unsafe-eval') so ONNX Runtime Web / Transformers.js can compile WebAssembly modules cleanly. -
worker-src 'self' blob:is required when bundlers or runtime libraries spawn helper workers. -
connect-srcmust allow the model CDN origin for the one-time weight download while keeping all audio processing endpoints strictly isolated.
Getting this right gave us zero CSP violations in production on our browser-local MP3 to Text & Whisper workspace.
3. Going Beyond Transcription: Rust/WASM Audio Engineering
Once you commit to zero-upload browser audio, a surprising amount of pro audio DSP becomes fast enough to run natively in a tab:
- Multitrack DAW in Rust/WASM: SoundCraft DAW compiles an entire multitrack audio engine, 25+ DSP effects, MIDI piano roll, and WAV/FLAC bounce to WebAssembly.
- Broadcast Loudness Metering: An ITU-R BS.1770-4 LUFS Meter computing K-weighted integrated/short-term/momentary loudness, LRA, and True Peak against Spotify (-14 LUFS) and Podcast (-16 LUFS) targets.
- FFT Fake-FLAC Detection: Checking high-frequency spectral brickwalls (16 kHz / 18 kHz) locally before converting FLAC to MP3.
What's Next
Next up we are experimenting with WebGPU chunk streaming for 60+ minute podcast episodes so live partial transcripts render while long recordings decode.
If you've built browser-local WebGPU/WASM audio apps, I'd love to compare notes on memory limits across mobile Safari and Chrome—drop a comment below!
Top comments (1)
Two things to watch when you move to chunked streaming for hour-long episodes. First, overlap windows duplicate words at the seam: ask Whisper for word timestamps and dedupe on timestamp rather than text, and keep the overlap at about a second so mobile decode time does not double. Second, Cache API weights (39-73 MB) get evicted under storage pressure on iOS unless navigator.storage.persist() is granted — a cold reload after a few quiet days turns the 2.7s warm run back into 24s, so gate the UI on navigator.storage.estimate() headroom. One more: expose detected language per chunk, because bilingual podcast episodes flip mid-file and the transcript comes back half English.