← All models

audio-frame-classification Β· audio Β· WASM Β· ~6 MB

Speaker diarization β€” who spoke when

Diarization answers a different question from "is someone talking?": it works out how many people are speaking and which of them is speaking at each moment β€” including where two voices overlap. This is pyannote's segmentation model, ~6 MB, running on the CPU in your browser, turning audio into a colour-coded speaker timeline with nothing uploaded.

At a glance

Modelonnx-community/pyannote-segmentation-3.0 (ONNX build of pyannote/segmentation-3.0)
Taskaudio-frame-classification β†’ speaker segmentation
Architecturepyannote segmentation (SincNet + LSTM), 7-class powerset of up to 3 speakers
OutputSpeaker-labelled segments (start, end, speaker id, confidence), incl. overlap
Params / dtype~1.5M Β· fp32
BackendWASM (CPU) β€” no GPU required; runs on mobile + desktop
Download~6 MB, cached after first load
LicenseMIT
Web APIsWeb Workers, WebAssembly, Web Audio (decoding)

Run it

TED talk clip

See inside

The model doesn't hear "words" β€” it slides over the audio and, for each short frame, classifies which combination of up to three speakers is active. Below is the raw per-frame activity it produced: grey = silence, indigo = one speaker, amber = overlapped speech. The timeline above is what you get after decoding those frames into speaker turns.

silence one speaker overlapped speech

Segments

Run diarization to see the segments.

Why it matters

Diarization is the layer that turns a transcript into a conversation: it tells you who said what. Paired with a speech recogniser, it's how you get "Speaker 1: … / Speaker 2: …" from a raw recording β€” and doing it on-device keeps the audio private.

Use cases

Basics

Diarize a clip and read the speaker timeline β€” the core "who spoke when".

Practical

Talk-time analytics: how long each speaker held the floor, and overlap.

Wild

Record from your mic and diarize your own conversation live.

Multi-model

wav2vec2 transcribes β†’ diarization attributes it to a speaker.

How the API works

It's an audio-frame-classification model with a diarization post-processor. Decode audio to the model's sample rate, run it, and let the processor turn the per-frame powerset logits into speaker segments:

import { AutoProcessor, AutoModelForAudioFrameClassification, read_audio }
  from "@huggingface/transformers";

const model_id = "onnx-community/pyannote-segmentation-3.0";
const model = await AutoModelForAudioFrameClassification.from_pretrained(model_id);
const processor = await AutoProcessor.from_pretrained(model_id);

const audio = await read_audio(url, processor.feature_extractor.config.sampling_rate); // 16 kHz mono
const inputs = await processor(audio);
const { logits } = await model(inputs);            // [1, frames, 7]  (powerset of up to 3 speakers)

const result = processor.post_process_speaker_diarization(logits, audio.length);
// [ [ { id: 0, start: 0, end: 1.05, confidence: 0.82 }, { id: 2, start: 1.05, end: 2.34, … }, … ] ]

This page runs exactly that in a Web Worker (decoding audio with Web Audio first), and draws the segments as a colour-coded speaker timeline.

References