Skip to main content

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

Release files for diarizer-lite 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diarizer-lite 0.1.0
File Size Uploaded
diarizer_lite-0.1.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diarizer-lite 0.1.0
File Interpreter ABI Platform
diarizer_lite-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / diarizer_lite-0.1.0.tar.gz

Download URL diarizer_lite-0.1.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
83f38c1e1235432519a8a6b086129ff392911190c5922d1ad58385b74d9eb479
BLAKE2b-256 checksum
How to use checksums
829fd39e3d774f89448f9bb2ae18e0585d02e1de55e43af83671dd0d17720630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / diarizer_lite-0.1.0-py3-none-any.whl

Download URL diarizer_lite-0.1.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9851938b8985056c164f8bc3262c18126ba57d794329398d44386037dd0fec8
BLAKE2b-256 checksum
How to use checksums
892790521d2e97dc05c7b22bae181242e1c1cfbc39e94bbc513bbfafc1956163
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page