Active Speaker Detection With a Sliding Window and Hysteresis

Last updated: November 29, 2026

Quick Overview

Given a time-ordered stream of (timestamp, participant, audio level) samples, emit the moments the active speaker changes, using the average level over the last W milliseconds and switching only when a challenger beats the current speaker by a margin.

Zoom
Coding & Algorithms
Software Engineer
Zoom
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Given a time-ordered stream of (timestamp, participant, audio level) samples, emit the moments the active speaker changes, using the average level over the last W milliseconds and switching only when a challenger beats the current speaker by a margin.

An onsite coding round themed on Zoom's speaker view, where the tile that fills the screen must follow the person talking without flickering on a cough or a laugh. The interviewer looks for a correct sliding window, a principled anti-flicker rule, and discussion of where this logic should run (client versus media server).

What the Interviewer Expects
  • Maintain per-participant windowed sums with deques
  • Treat missing samples as silence so stale speakers decay
  • Apply hysteresis and a minimum loudness floor
  • Emit only changes, not every tick
  • Analyze cost per sample and per meeting size
Key Topics to Cover
Sliding window
Deque
Hysteresis
Streaming
Debouncing
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you make each sample O(log U) instead of O(U) for a 1000 person webinar?
  • How would you add a minimum hold time so the view never switches twice within two seconds?
  • Should this run on the SFU or on each client, and why?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Samples arrive every 20 ms per sending participant with levels 0 to 100. The score of a participant is their average level over the last W ms. We return (t, user) whenever the active speaker chang...

High-Level Design

Per participant keep a deque of (t, level) and a running sum. On each sample, evict anything at or before t - W and update the sum. Dividing by the full window (not by the number of samples) means...


Submit Your Answer
Markdown supported

Related Questions