Shipped a production voice-to-voice AI pipeline achieving sub-200ms end-to-end latency - browser audio capture → 16kHz PCM streaming → Azure STT → frontier LLM → Azure TTS → gapless playback - a real-time full-duplex loop that most teams never take beyond a hackathon demo, running live for every visitor with 36 selectable models.
Enabled natural conversational AI for 500+ visually impaired users across 50+ spoken languages with 99% Voice Activity Detection accuracy - hands-free, eyes-free access to GPT, Claude Opus, Gemini, and Grok delivered by the core architecture itself (VAD means no button to find, no screen to read), not a bolt-on accessibility mode.
Engineered the entire capture chain with zero external audio libraries - raw Web Audio API with custom 48kHz-Float32 → 16kHz-16bit-PCM downsampling in 4096-sample ScriptProcessor buffers producing the exact byte format Azure Speech consumes - eliminating dependency weight, transcoding hops, and the latency they add.
Blocked wasted LLM inference on non-speech at the source: server-side noise/filler filtering discards empty results, dots, hums, and uh/ah patterns before they ever reach a model, while the ChromaDB voice-answer memory returns a previously generated answer for a semantically similar question, skipping the RAG pass and the model call entirely - two layers of cost elimination on every conversational turn.
Bounded the platform's most expensive request type (every utterance = STT + LLM + TTS spend) with dedicated Redis voice rate limits (2 requests/12h, keyed on userId + modelId + IP) and JWT validation on the WebSocket upgrade handshake before a single audio byte is processed - contributing to the platform's 99% API abuse reduction with zero unauthorized model invocations across 50K+ daily API calls.
Closed the token-leakage hole common in WebSocket auth: carrying the JWT in the Sec-WebSocket-Protocol header instead of the URL query string keeps credentials out of server, proxy, and CDN access logs entirely - a security posture most production WebSocket deployments get wrong.
Guaranteed privacy by design under real load: audio is processed in real time and never stored raw, every session is WSS-encrypted in transit, and the deterministic six-step teardown chain (processor → gain → source → context → tracks → socket) has produced zero leaked microphone streams and zero zombie connections across unlimited start/stop cycles.
Proved the multiplexed transport design in production: binary audio frames and JSON control envelopes share one WebSocket with defensive try/catch isolation, so a malformed chunk degrades a single response instead of killing the session - while structured rate-limit envelopes auto-stop recording and render live reset countdowns with zero polling.
Drove retention on the platform's most differentiated capability: every voice session persists to revisitable history, users switch between 36 brains per session without losing past conversations, and the voice mode became a primary reason cited in the 800+ user feedback submissions behind the platform's 99% satisfaction rate.
Made noise structurally free and abuse structurally bounded on the most expensive pipeline in the platform - one utterance costs speech recognition, a model call and synthesis - by ordering the pipeline so that a length floor and filler-pattern filters run in two independent modules before the rate limiter, before any embedding, and before any model call: a cough or a false positive consumes nothing, while a genuine request is quota-checked before a single billable call is made.
Built the most failure-tolerant of the three products on the same infrastructure: the voice-answer cache is fully guarded so a vector-store outage degrades into a normal generation instead of an error, every post-connect failure produces spoken feedback rather than silence - because in a voice interface silence is indistinguishable from a broken microphone - and session resources are released in a deliberately ordered teardown, so repeated connect and disconnect cycles leave no orphaned recognizers, synthesizers or timers.
Architected Voice with 36+ Brains ("Your Voice. 36+ Minds.") - a real-time voice-to-voice AI product at /voice (Next.js 15 App Router, React 19, TypeScript 5, Tailwind CSS 4) enabling spoken conversations with 36 frontier models across 11 providers - GPT 6.1 Sol, GPT 6 Luna/Astra, Claude Opus 5 and Opus 4.8, Gemini 3.8 Flash, Grok 4.7, LLaMA, Mistral, Kimi, DeepSeek and more - over a full-duplex WebSocket pipeline with sub-200ms response latency, Voice Activity Detection (no push-to-talk, no button holding), and 50+ spoken languages: no typing, just talk.
Engineered the client-side audio capture pipeline entirely in the browser: getUserMedia at 48kHz with echoCancellation, noiseSuppression, and autoGainControl → AudioContext → MediaStreamSource → ScriptProcessor (4096-sample buffers) extracting Float32 PCM per frame → custom downsampleTo16kPCM converting 48kHz Float32 to 16kHz 16-bit PCM (the exact format Azure Speech expects) → binary frames streamed over the WebSocket only while the socket is OPEN and the client is in listening state - with a zero-gain GainNode terminating the processing graph so the audio pipeline stays alive without feeding the mic back to the speakers.
Implemented security-first connection setup in createVoiceRecordSocket(accessToken, modelId): the API base URL is protocol-swapped via regex (http→ws, https→wss), the selected model travels as a URL-encoded modelId query parameter for per-connection model negotiation, and the JWT is passed as the WebSocket subprotocol - new WebSocket(wsUrl, [accessToken]) - landing in the Sec-WebSocket-Protocol header instead of the URL so credentials never appear in server, proxy, or CDN access logs; the token is validated on the upgrade handshake before a single audio byte is accepted, and users can talk to any of the 36 brains and switch models between sessions without losing conversation history.
Built the server voice pipeline on Azure Speech Services: continuous Speech-to-Text recognition with intelligent noise/filler filtering (auto-discards empty results, dots, hums, uh/ah patterns before they reach the LLM), recognized utterances routed through the model router to the selected frontier model with RAG-grounded context, and responses synthesized via Azure Text-to-Speech (en-US-AndrewNeural) with SSML prosody control (rate +15%, pitch +5%) - the synthesized audio streamed back as binary chunks over the same WebSocket and backed by a ChromaDB voice-answer memory that returns a previously generated answer for a semantically similar question, skipping the RAG pass and the model call entirely - the answer is text, so it is re-synthesized on every hit.
Designed dual-protocol message multiplexing on a single WebSocket: binary frames (Blob/ArrayBuffer) carry audio, while JSON text frames carry control envelopes - the client's onmessage handler safely attempts JSON parsing on string data to catch structured rate-limit envelopes ({success: false, rateLimit: {resetInSeconds}}) that immediately stop recording and render a live countdown timer, while all binary chunks flow into an AudioContext playback queue that decodes (decodeAudioData) and plays chunks sequentially for gapless speech output - with defensive try/catch isolation so a single malformed chunk can't kill the message loop.
Built the full-page voice chat application at /voice/chat with a session-history sidebar (persisted via Zustand chatHistoryStore - every voice session saved and revisitable), rebuilt in the same dark workspace frame as ARX and Versus - a title bar whose breadcrumb shows the latest question with a live Listening / Speaking / Connected status, a labelled rail (Agents, Voice, Models, Chat), a searchable session list grouped Today / Earlier with the model and time on every row, a transcript view that reopens any past turn, and a Try-saying side panel - around a voice interface card with connection, recording and processing states, a center-weighted waveform visualizer animating at 100ms intervals, a mic button with dual animated ping rings, and a provider-grouped model picker that locks while a conversation is live - responsive down to phone width with drawer panels.
By category
Layer 1 / 8
LLMsFrontier models routed per request: OpenAI, Anthropic, Google, xAI, Meta and more.From your microphone to a spoken answer on one socket. Click any step to see what runs there and where it lives in the code.