Speaker Diarization
Learn how to identify who said what in your audio files by adding speaker labels to your transcript.
The Speaker Diarization model lets you detect multiple speakers in an audio file and what each speaker said.
If you enable Speaker Diarization, the resulting transcript will return a list of utterances, where each utterance corresponds to an uninterrupted segment of speech from a single speaker.
Want to name your speakers?
Speaker Diarization assigns generic labels like “Speaker A” and “Speaker B” to distinguish between speakers. If you want to replace these labels with actual names or roles (e.g., “John Smith” or “Customer”), use Speaker Identification. Speaker Identification analyzes the conversation content to infer who is speaking and transforms your transcript from generic labels to meaningful identifiers.
Quickstart
Python SDK
Python
JavaScript SDK
JavaScript
To enable Speaker Diarization, set speaker_labels to True in the transcription config.
Example output
By default, the upper limit on the number of speakers for Speaker Diarization is 10. If you expect more than 10 speakers, you can use speaker_options to set a range of possible speakers.
Set number of speakers expected
You can set the number of speakers expected in the audio file by setting the speakers_expected parameter.
Only use this parameter if you are certain about the number of speakers in the audio file.
Building on the Quickstart above, add speakers_expected to your transcription config:
Python SDK
Python
JavaScript SDK
JavaScript
Set a range of possible speakers
You can set a range of possible speakers in the audio file by setting the speaker_options parameter. By default, the model will return between 1 and 10 speakers.
This parameter is suitable for use cases where there is a known minimum/maximum number of speakers in the audio file that is outside the bounds of the default value of 1 to 10 speakers.
Setting max_speakers_expected too high may reduce diarization accuracy,
causing sentences from the same speaker to be split across multiple speaker
labels.
Building on the Quickstart above, add speaker_options to your transcription config:
Python SDK
Python
JavaScript SDK
JavaScript
API reference
Request
Speakers Expected
Speaker Options
Response
The response also includes the request parameters used to generate the transcript.
Identify speakers by name
Speaker Diarization assigns generic labels like “Speaker A” and “Speaker B” to each speaker. If you want to replace these labels with actual names or roles, you can use Speaker Identification to transform your transcript.
Before Speaker Identification:
After Speaker Identification:
The following example shows how to transcribe audio with Speaker Diarization and then apply Speaker Identification to replace the generic speaker labels with actual names.
Python
JavaScript
For more details on Speaker Identification, including how to identify speakers by role and how to apply it to existing transcripts, see the Speaker Identification guide.
Best practices for accurate diarization
Follow these tips to get the best results from Speaker Diarization:
- Ensure sufficient speech per speaker. Each speaker should speak for at least 30 seconds uninterrupted. The model may struggle to create separate clusters for speakers who only contribute short phrases like “Yeah”, “Right”, or “Sounds good”.
- Minimize cross-talk. Overlapping speech between speakers can reduce diarization accuracy. Where possible, ensure speakers take turns.
- Reduce background noise. Background noise, echoes, or playback of recorded audio during a conversation can interfere with speaker separation.
- Use
speaker_optionsinstead ofspeakers_expectedwhen uncertain. Only usespeakers_expectedwhen you are confident about the exact number of speakers. If this number is incorrect, the model may produce random splits of single-speaker segments or merge multiple speakers into one. It’s generally recommended to usemin_speakers_expectedand setmax_speakers_expectedslightly higher (e.g.,min_speakers_expected+ 2) to allow flexibility. - Avoid setting
max_speakers_expectedtoo high. Setting the maximum too high may reduce accuracy, causing sentences from the same speaker to be split across multiple speaker labels. - Be aware of speaker similarity. If speakers sound similar, the model may have difficulty distinguishing between them.
Frequently asked questions
How many speakers can the model handle?
By default, the upper limit on the number of speakers for Speaker Diarization
is 10. If you expect more than 10 speakers, you can use
speaker_options
to set a range of possible speakers.
How accurate is the Speaker Diarization model?
The accuracy of the Speaker Diarization model depends on several factors, including the quality of the audio, the number of speakers, and the length of the audio file. See the best practices section above for tips on improving accuracy.