Add real-time speaker diarization support

- New whisper_live/diarization.py: SpeakerDiarizer with online clustering
- Uses pyannote.audio speaker embeddings (optional dependency)
- Cosine similarity threshold for speaker matching (default 0.55)
- Running average embedding update for speaker stability
- Configurable max_speakers limit (default 10)
- Client options: enable_diarization, max_speakers
- Segments include 'speaker' field when diarization is active
- Graceful fallback: logs warning if pyannote not installed
- Added 12 unit tests (mock-based, no GPU required)
This commit is contained in:
Aaron Boxer
2026-04-17 10:25:10 -04:00
committed by Aaron Boxer
parent 3d63e82571
commit 18b897277f
7 changed files with 364 additions and 6 deletions
@@ -35,6 +35,7 @@ class ServeClientFasterWhisper(ServeClientBase):
cache_path="~/.cache/whisper-live/",
translation_queue=None,
hotwords=None,
diarization=None,
):
"""
Initialize a ServeClient instance.
@@ -64,7 +65,8 @@ class ServeClientFasterWhisper(ServeClientBase):
no_speech_thresh,
clip_audio,
same_output_threshold,
translation_queue
translation_queue,
diarization,
)
self.cache_path = cache_path
self.model_sizes = [