Taqwa StudiosCase study 08 / 20
Swear Jar
An always-on office mic that catches swearing, works out who said it by their voice, and tallies what they owe on a live dashboard. Built for the laugh, engineered properly.
Role
Sole designer and engineer
Status
● Running in production
Models
Whisper + Resemblyzer, on the server · no LLM
Stack
Python + FastAPI · webrtcvad · Whisper · Resemblyzer · React · WebSockets
The short version
- A real two-model speech pipeline: voice-activity detection, transcription, then speaker identification.
- The speaker model only runs when a swear is actually found, so the expensive step is the rare one.
- Everything runs on-site. No audio leaves the network.
01Why I built it
Honestly, for the laugh. But “what was said and who said it” is a genuinely hard problem, and building it end to end on a home server was the point.
02How it works
- CaptureAudio is streamed continuously and grouped into utterances by webrtcvad, resampled to 16 kHz.
- TranscribeWhisper transcribes each utterance.
- MatchA whole-word, plural-aware profanity list checks the transcript.
- IdentifyOnly on a hit: Resemblyzer creates a 256-dimension voiceprint, matched by cosine similarity against enrolled people, above a threshold or “Unknown”.
- TallyPer-person count, charges, leaderboard and an audio clip saved per incident, pushed live over WebSockets.
03Model choices, and why
Speech to text
Whisper
Accurate on conversational speech, and runs locally.
Who said it
Resemblyzer speaker embeddings
Small, fast voiceprints that work from a few seconds of enrolment audio.
Language model
None
Spotting a word in a transcript is string matching. A language model would add cost and latency and send office speech off-site, for nothing.
04Enrolment: what the system knows
- Three short samples per person. Each person records 3 × 4 seconds in the browser once.
- Re-matchable history. When someone new enrols, past “Unknown” incidents can be re-attributed.
05Compute discipline
- Voice-activity detection means Whisper only ever sees speech, not silence.
- Speaker identification runs only when a swear is detected, not on every utterance.
- No per-use cost: both models run on the server.
06Performance
- Runs as a single service at about 55 MB of RAM.
- Incidents appear on the dashboard in real time over WebSockets.
07Trade-offs I made
Chose
Run speaker ID only on a hit
Over
Diarise everything
Chose
Local models
Over
Cloud speech APIs
Chose
Word list
Over
An LLM judging profanity
08Guardrails
- Fully local: transcripts, clips and voiceprints stay on the server.
- An editable word list and engine start/stop control from the dashboard.
09What I'd do next
- Since it's an always-on mic, the right next step is a clear schedule and an on-screen indicator whenever it's listening.
10What this shows
Applied AI engineering
A cost-aware cascade: cheap filters first, expensive model only when needed.
Product
A fun brief taken seriously enough to ship.
Solutions
Real-time audio, ML and a live dashboard on commodity hardware.
Across the fleet: every build runs on one self-hosted Linux server, binds to localhost and is reached only over a private Tailscale network. AI inference runs on a Claude subscription through one in-house router (part of Sentry) rather than per-token API keys, with open-weight models on Ollama as the local layer: on the server, and on a 64 GB MacBook Pro shared over Tailscale for heavier local work. Everything is backed up to GitHub and a separate cold disk, and nothing reaches another person without a human tap.
Hiring for applied AI, product or solutions work? I'd like to hear about it.