Lightweight stereo-based diarization for timestamped STT segments
Project description
diarizer-lite
A Lightweight speaker diarization library using stereo audio energy for timestamped speech-to-text (STT) transcripts.
What this package does
Most modern STT systems such as - Whisper, Whisper-faster, Deepgram, AssemblyAI, AWS Transcribe, Google STT, etc... can output timestamped segments of text, but they either:
- don’t do speaker diarization at all, or
- require cloud billing for diarization, or
- produce overly granular segments (short “speaker turns”), or
- lack merging into coherent speaker turns for downstream use
diarizer-lite fills this gap by performing lightweight speaker assignment using stereo audio
channel energy (left/right RMS) to determine who spoke when.
Unlike ML-based diarization (e.g. Pyannote, embeddings, VAD models), this method:
- does not require GPUs
- does not require machine learning
- runs offline
- works with raw stereo call recordings with any format (mp3, wav, etc.)
- merges consecutive segments into human-readable speaker turns
This makes it ideal for:
- call center analytics
- customer ↔ agent conversations
- post-processing Whisper transcripts
- LLM conversation input formatting (context engineering)
- summarization pipelines
- sentiment/emotion analysis
- compliance/regulatory auditing
Why this matters
Large Language Models (LLMs) can summarize, analyze sentiment, and extract insights from transcripts — but only if speaker turns are well structured.
Example:
“Okay. Okay. Okay.”
doesn’t help a summarizer as separate lines, but merged as one speaker turn it becomes useful context.
diarizer-lite converts fragmented timestamped segments into proper conversational turns, enabling
LLMs to better understand who said what and when.
Supported Inputs
- Audio:
.wav,.mp3,.flac(stereo recommended) - Segments: list of
{start, end, text}dicts from STT systems
Compatible with outputs from:
- Whisper / Faster-Whisper
- Deepgram
- AssemblyAI
- AWS Transcribe (post-word-grouping)
- Google Speech-to-Text (post-word-grouping)
- Riva / Vosk / Coqui
- Any STT that outputs timestamps
Installation
pip install diarizer-lite
Usage
from diarizer_lite import Diarizer
d = Diarizer()
diarized = d.diarize_segments(
audio_file="call.wav",
segments=segments
)
Before / After Example
Input (timestamped STT segments)
segments = [
{"start": 0.0, "end": 4.0, "text": "Hi, I wanted to report an issue with my ride this morning."},
{"start": 4.0, "end": 7.0, "text": "Sure, could you tell me what happened?"},
{"start": 7.0, "end": 13.0, "text": "Yeah, driver was polite but car wasn't clean and smelled weird."},
{"start": 13.0, "end": 17.0, "text": "I'm sorry to hear that. Anything else?"},
{"start": 17.0, "end": 22.0, "text": "Also he took a longer route even after I gave the correct address."},
{"start": 22.0, "end": 25.0, "text": "Got it. We will look into this and report back."}
]
Output (diarized speaker turns)
[
{"start": 0.0, "end": 4.0, "speaker": "Speaker0",
"text": "Hi, I wanted to report an issue with my ride this morning."},
{"start": 4.0, "end": 7.0, "speaker": "Speaker1",
"text": "Sure, could you tell me what happened?"},
{"start": 7.0, "end": 13.0, "speaker": "Speaker0",
"text": "Yeah, driver was polite but car wasn't clean and smelled weird."},
{"start": 13.0, "end": 17.0, "speaker": "Speaker1",
"text": "I'm sorry to hear that. Anything else?"},
{"start": 17.0, "end": 25.0, "speaker": "Speaker0",
"text": "Also he took a longer route even after I gave the correct address. Got it. We will look into this and report back."}
]
Mono Fallback
If audio is mono, diarizer-lite cannot infer speakers and returns:
speaker="Unknown"
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diarizer_lite-0.1.0.tar.gz.
File metadata
- Download URL: diarizer_lite-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83f38c1e1235432519a8a6b086129ff392911190c5922d1ad58385b74d9eb479
|
|
| MD5 |
e56dded7d653c8ed21df9b271e6943cb
|
|
| BLAKE2b-256 |
829fd39e3d774f89448f9bb2ae18e0585d02e1de55e43af83671dd0d17720630
|
File details
Details for the file diarizer_lite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: diarizer_lite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9851938b8985056c164f8bc3262c18126ba57d794329398d44386037dd0fec8
|
|
| MD5 |
ae8a0e97b21d9187a918a8ba40ca041a
|
|
| BLAKE2b-256 |
892790521d2e97dc05c7b22bae181242e1c1cfbc39e94bbc513bbfafc1956163
|