Speaker diarization is the process of dividing an audio stream into distinct segments based on speaker identity. In simpler terms, it answers the question, "Who spoke when?"

Illustration of speaker diarization

Previously, we introduced you to some of the Top Speaker Diarization APIs and SDKs currently available in the market. In this article, we'll dive into practical demonstrations of three Python-based speaker diarization frameworks, showcasing their capabilities through a straightforward speaker diarization task.


Getting started with pyannote.audio for speaker diarization is straightforward. Follow these steps:

  1. Install the pyannote.audio package using pip:
  1. Obtain your authentication token to download pretrained models by visiting their Hugging Face pages.

  2. Use the following Python code to perform speaker diarization on an audio file:

This code will perform speaker diarization and print out the identified speakers along with their corresponding segments in the audio file.


To perform speaker diarization using NVIDIA NeMo, follow these steps:

  1. Install dependencies:
  1. Install NeMo:
  1. Download the config file for the inference from the NeMo GitHub repository.

  2. Generate and store the manifest file by running the following code:

Replace /PATH/TO/AUDIO_FILE.wav with the path to your audio file and /PATH/TO/MANIFEST_FILE.json with the desired path for your manifest file.

  1. Load the config file and define a ClusteringDiarizer object:

Replace /PATH/TO/OUTPUT_DIR and /PATH/TO/CONFIG_FILE.yaml with the desired paths for your output directory and config file, respectively.

  1. Perform speaker diarization on the audio file:

The output of the speaker diarization will be stored in the OUTPUT_DIR directory as a Rich Transcription Time Marked (RTTM) file.

Simple Diarizer

Simple Diarizer is a speaker diarization library that utilizes pretrained models from SpeechBrain. To get started with simple_diarizer, follow these steps:

  1. Install the package using pip:
  1. Define a Diarizer object:
  1. Perform speaker diarization on an audio file by either passing the number of speakers:

Or by passing a threshold value:

The speaker information and timing details, including the start and end times of each segment, are stored in the segment variable.

Falcon Speaker Diarization

Falcon Speaker Diarization is an on-device speaker diarization engine powered by deep learning. To get started with Falcon Speaker Diarization, follow these steps:

  1. Install the package using pip:
  1. Sign up for Picovoice Console for free and copy your AccessKey. It handles authentication and authorization.

  2. Create an instance of the engine:

  1. Perform speaker diarization on an audio file:

The segments variable represents an array of segments, each of which includes the segment's timing and speaker information.

For more information about Falcon Speaker Diarization, check out the Falcon Speaker Diarization product page or refer to the Falcon Speaker Diarization Python SDK quick start guide.

Start Building