The Inspiration

Back in high school, my friend Ahmad Zeid and I were deep into the Model United Nations (MUN) circuit. We learned the hard way that winning a debate is 40% logic and 60% stage presence. You can have the most bulletproof resolution on paper, but if you’re breaking eye contact, slouching, leaking nervous energy, or citing fake statistics, you lose the room.

We always wished we had a sparring partner who wouldn't just argue with us, but would actually coach our delivery under pressure. Debate Guard is exactly what we needed back then. It’s a multimodal AI opponent that attacks your logic while simultaneously tracking your body language and fact-checking your claims in real-time.

Check it out:
preview

How We Built It

We built a highly orchestrated real-time engine using a React/Vite/TypeScript frontend and a FastAPI/SQLModel backend, powered by the Gemini 2.5 Flash Multimodal Live API.

  • The Unified Multiplexer: Instead of juggling multiple connections, we built a single WebSocket protocol routing 16kHz PCM binary audio, 1 FPS base64 JPEG frames, and JSON telemetry over one pipe.
  • The "Debunker" Tool: We tied the Gemini Live session to Google Search. If you cite a fake statistic to win a point, the AI queries it mid-conversation, debunks you, and calls you out on the spot.
  • The Heuristics Engine: We didn't want to use AI to guess body language—it's too slow. Instead, we run MediaPipe locally at 30 FPS. We translated psychological "tells" into pure geometric variance.

Challenges We Faced

  1. The 5-Second Discrete Buffer: Initially, we tried evaluating body language frame-by-frame, but that failed to capture time-based physical tells like swaying or rapid head turning. We had to architect a strict 5-second matrix buffer that evaluates oscillation before flushing the memory and starting over.
  2. Audio Interruptions: In a real debate, people talk over each other. If we just streamed audio blindly, the AI would lose its train of thought on every mic bump. We built a 5.0-second continuous voice threshold. If the user steamrolls the AI for more than 5 seconds, we intercept the stream and inject a system command: [Acknowledge the interruption briefly, but maintain your stance].
  3. API Limits & Latency: Multimodal AI is heavy. Streaming 30 FPS video to Gemini would have instantly hit the token ceiling and spiked latency. We optimized by processing the 30 FPS video locally for telemetry, and only sending heavily compressed 1 FPS JPEGs to the AI for facial context.

What We Learned

Building Debate Guard forced us to master real-time multimodal architectures. We learned how to manipulate raw PCM binary data via the Web Audio API, how to build custom multiplexing over WebSockets, and most importantly, how to seamlessly bridge client-side deterministic math (MediaPipe geometry) with server-side generative AI (Gemini Live) to create a zero-latency, highly aggressive AI agent.

Built With

Share this project:

Updates

Submission history