Nodes/ComfyUI_pyannote/Speaker Diarization
ComfyUI Node

Speaker Diarization

Who said that? Add speaker labels to any audio with PyAnnote

By ramesh-x90·Created 2 years ago·Updated 28 days ago· 5
Speaker Diarization
  • audio
  • speaker_segments
hf_token

You've got an interview recording, a podcast episode, or a meeting video and you need to know who's talking and when. That's speaker diarization - "who spoke when" - and this node does it locally with PyAnnote. No cloud API, no per-minute transcription bill. The catch: the model is gated on Hugging Face, so there's one token involved before it works. We'll get to that.

ComfyUI grew up as an image-and-video tool, and a lot of the ecosystem is still diffusion-shaped. But audio has been creeping in: Whisper nodes for speech-to-text, TTS, and now this. Speaker Diarization is the front half of a "turn a recording into a script" pipeline. It takes an audio clip and returns a list of segments with start time, end time, and a speaker label (SPEAKER_00, SPEAKER_01, …). Wire that into the pack's other node, Whisper Segments to Speaker, and your transcript goes from a wall of text to an actual dialogue.

How it works

Under the hood it loads pyannote/speaker-diarization-3.1 from the PyAnnote library, writes your audio to a temp WAV file in ComfyUI's input folder, runs the pipeline, and collects every detected turn into a list. Note the model is hardcoded - there's no dropdown to swap in a different diarization model, it's always 3.1. The repo even has a commit specifically fixing the token handling for that model version, so make sure you're on the latest pull.

Inputs and outputs

Only two inputs, both required:

  • audio (AUDIO) - whatever audio you're processing, loaded via any audio-load node that outputs the AUDIO type.
  • hf_token (STRING) - your Hugging Face access token, pasted straight into the field.

That's it. The output, speaker_segments, is a list of dicts each holding start, end, and speaker. It's the exact input type the pack's Whisper Segments to Speaker node expects, so that's where it goes next.

Installing it

Search ComfyUI_pyannote in ComfyUI Manager and hit install, or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/ramesh-x90/ComfyUI_pyannote
cd ComfyUI_pyannote
pip install -r requirements.txt

Then restart ComfyUI. Fair warning: the dependency list is pyannote.audio, torch, torchaudio, and pydub. That's a real install - PyAnnote brings a chunk of its own model machinery, and if your torch is on CPU it'll run, just slowly. The first run also downloads the 3.1 model into your Hugging Face cache, a few hundred MB, so don't panic when the first execution hangs for a while.

Common issues

The token won't authenticate. This is the one people actually get stuck on. pyannote/speaker-diarization-3.1 is a gated model: you have to open its page on Hugging Face, click through the license agreement, then create a token with read access in your account settings. A token from an account that never accepted the terms gets a 401/403 regardless of permissions. The README mentions the token requirement but not the gating, which is the part that bites.

Every run writes a WAV to the input folder. The node round-trips your audio through ComfyUI/input as a UUID-named file. If that directory isn't writable, or you're in a restricted environment, the node fails before it ever talks to PyAnnote. Harmless to clean up, just know the files are there.

Long files are slow. Diarization is a full pass over the audio with a neural segmentation model, then clustering. A short clip is seconds; an hour-long podcast on CPU is a "go make coffee" situation. That's PyAnnote being PyAnnote, not the node doing anything wrong.

Categorysd

Inputs (2)

NameTypeDefaultDescription
audioAUDIO
hf_tokenSTRING

Outputs (1)

NameTypeDescription
speaker_segmentsspeaker_segments