Speaker Diarization
Unlock the full power of your audio content with industry-leading speaker diarization. Identify speakers to create structured, speaker-labeled transcripts that bring clarity to even the most complex conversations.


1import assemblyai as aai
2
3aai.settings.api_key = "YOUR_API_KEY"
4
5transcriber = aai.Transcriber()
6
7audio_url = (
8 "https://assembly.ai/sports_injuries.mp3"
9)
10
11config = aai.TranscriptionConfig(speaker_labels=True)
12
13transcript = transcriber.transcribe(audio_url, config)
14
15print(transcript.text)
16
17for utterance in transcript.utterances:
18 print(f"Speaker {utterance.speaker}: {utterance.text}")
1import { AssemblyAI } from 'assemblyai'
2
3const client = new AssemblyAI({
4 apiKey: 'YOUR_API_KEY'
5})
6
7const audioUrl =
8 'https://assembly.ai/sports_injuries.mp3'
9
10const params = {
11 audio: audioUrl,
12 speaker_labels: true
13}
14
15const run = async () => {
16 const transcript = await client.transcripts.transcribe(params)
17 console.log(transcript.text)
18
19 for (let utterance of transcript.utterances!) {
20 console.log(`Speaker ${utterance.speaker}: ${utterance.text}`)
21 }
22}
23
24run()
1package main
2
3import (
4 "context"
5 "fmt"
6 "os"
7
8 aai "github.com/AssemblyAI/assemblyai-go-sdk"
9)
10
11func main() {
12 ctx := context.Background()
13
14 audioURL := "https://assembly.ai/sports_injuries.mp3"
15
16 client := aai.NewClient("YOUR_API_KEY")
17
18 params := &aai.TranscriptOptionalParams{
19 SpeakerLabels: aai.Bool(true),
20 }
21
22 transcript, err := client.Transcripts.TranscribeFromURL(ctx, audioURL, params)
23 if err != nil {
24 fmt.Println("Something bad happened:", err)
25 os.Exit(1)
26 }
27
28 fmt.Println(*transcript.Text)
29
30 for _, utterance := range transcript.Utterances {
31 fmt.Printf("Speaker %v: %v
32", *utterance.Speaker, *utterance.Text)
33 }
34}
1import com.assemblyai.api.AssemblyAI;
2import com.assemblyai.api.resources.transcripts.types.*;
3
4public final class App {
5 public static void main(String[] args) {
6 AssemblyAI client = AssemblyAI.builder()
7 .apiKey("YOUR_API_KEY")
8 .build();
9
10 String audioUrl = "https://assembly.ai/sports_injuries.mp3";
11
12 var params = TranscriptOptionalParams.builder()
13 .speakerLabels(true)
14 .build();
15
16 Transcript transcript = client.transcripts().transcribe(audioUrl, params);
17
18 System.out.println(transcript.getText().get());
19
20 transcript.getUtterances().get().forEach(utterance ->
21 System.out.println("Speaker " + utterance.getSpeaker() + ": " + utterance.getText())
22 );
23 }
24}
1require 'assemblyai'
2
3client = AssemblyAI::Client.new(api_key: 'YOUR_API_KEY')
4
5audio_url = 'https://assembly.ai/sports_injuries.mp3'
6
7transcript = client.transcripts.transcribe(
8 audio_url: audio_url,
9 speaker_labels: true
10)
11
12abort transcript.error if transcript.status == AssemblyAI::Transcripts::TranscriptStatus::ERROR
13
14puts transcript.text
15
16transcript.utterances.each do |utterance|
17 printf('Speaker %<speaker>s: %<text>s', speaker: utterance.speaker, text: utterance.text)
18end
Build confidently with accurate, multilingual speaker diarization

Enhance conversation analysis and speaker-dependent AI models with industry-leading speaker count accuracy. Our models achieve a 2.9% error rate, outperforming competitors in identifying the number of speakers.

Support speaker diarization in 95 languages, enabling multilingual audio analysis and expanding your product's global market potential.
Make every voice count
Improve the readability of your transcriptions | Unlock call center insights | Create a better search experience | Assess communication patterns |
Optimize short-form content generation | Enhance automated dubbing precision | Implement intelligent camera focus | Determine talk time for sales teams |
Join 200K+ developers building new experiences with voice data

"We have had a phenomenal experience so far. The integration was simple and easy for developers to get started. The accuracy is better than any other tools in the market (and we have tried them all). Highly recommend!"

"Works incredibly well out of the box. Allowed us to focus on product instead of infrastructure. As a result, we were able to bring a transformative new product to market in half the time."

"The accuracy was strong, but the great documentation and unique models like Auto Chapters and Sentiment Analysis is what really won us over."

"Partnering with AssemblyAI has made it easy for us to deliver world-class voice intelligence powered by market-leading speech-to-text technology."
Turn voice data into unparalleled product experiences
Partner with the leader in Speech AI to build powerful products with breakthrough industry impact.
