zebra-report/web
Russell Ballestrini 9b91c726e5
zebra-spaces: Whisper inference in Web Worker + global inflight gate
Fox 2026-06-05: "the web page for zebra spaces seems noticeably slower
after enabling transcribe… even the tones for entering and leaving are
showing up way way later even on the host side."

Root cause: ONNX Runtime via transformers.js was running on the main
thread, blocking JS for 1–3 seconds per chunk. Join/leave chimes,
button clicks, scroll, EVERY UI gesture queues behind it.

Two changes:

1. Move Whisper to a dedicated module Web Worker. The worker imports
   transformers.js + loads the whisper-tiny.en pipeline ONCE; each
   chunk is transferred (zero-copy) via postMessage, processed in
   isolation from the UI thread, and the resulting text is posted
   back. Main thread is free during inference now — UI stays
   responsive. Worker is created on first toggle ON; same ~40MB
   model download still happens, just off-thread.

2. Global "inflight gate" on the main thread side. Only one
   transcribe request can be in flight at a time. If a new chunk
   arrives while busy, DROP it (don't queue). Counter is logged
   every ~30s so we can see worker saturation. With N speakers all
   talking at once, dropping is correct — stale chunks from 10s ago
   aren't worth transcribing.

Combined with the RMS silence gate in the capture worklet, the result
is: silent chunks never even reach the main thread, busy chunks are
processed sequentially by the worker, and the UI never blocks.

Phase 4 (deferred): switch to WebGPU backend for ONNX where supported
— roughly 2-5× faster than WASM on capable devices. transformers.js
v3 supports this with `{ device: 'webgpu' }` in pipeline opts.
2026-06-05 13:11:08 -04:00
..
blog phase 1: unfirehose reconstruction from session JSONL ingest 2026-05-27 13:51:14 -04:00
fonts phase 2: gap analysis — cat>> append + binary asset recovery 2026-05-27 13:54:19 -04:00
chat.html zebra-spaces: listener mute button doubles as audio-unlock gesture 2026-06-03 20:57:09 -04:00
host-your-own.html zebra-spaces: listener mute button doubles as audio-unlock gesture 2026-06-03 20:57:09 -04:00
how-it-works.html zebra-spaces: listener mute button doubles as audio-unlock gesture 2026-06-03 20:57:09 -04:00
index.html web: bump mobile body padding from 1rem to 1.25rem so the right edge has visible breathing room 2026-05-31 14:13:25 -04:00
kernel.html web: bump mobile body padding from 1rem to 1.25rem so the right edge has visible breathing room 2026-05-31 14:13:25 -04:00
stamp.js web: stamp each zebra-report page with build date + md5/sha256 2026-05-28 17:50:12 -04:00
zebra-audio.html zebra-spaces: listener mute button doubles as audio-unlock gesture 2026-06-03 20:57:09 -04:00
zebra-spaces.html zebra-spaces: Whisper inference in Web Worker + global inflight gate 2026-06-05 13:11:08 -04:00