Use the Transcriber object’s transcribe method and pass in the audio file’s path and config object as parameters. The transcribe method saves the results of the transcription to the Transcriber object’s transcript attribute.
Alternatively, you can use an audio URL available on the internet.
Extract the utterances from the transcript and set this to utterances.
utterances = transcript.utterances
Import the matplotlib.pyplot library. Then use the following plot_speaker_timeline function which results in a plot image of the speaker timeline. This function extracts the start and end timestamps of each utterance per speaker and plots the data onto the horizontal bar chart. The X and Y axis are labelled accordingly.
import matplotlib.pyplot as pltdef plot_speaker_timeline(utterances): fig, ax = plt.subplots(figsize=(12, 4)) colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k'] speaker_colors = {} for utterance in utterances: start = utterance.start / 60000 # in minutes end = utterance.end / 60000 # in minutes speaker = utterance.speaker if speaker not in speaker_colors: speaker_colors[speaker] = colors[len(speaker_colors) % len(colors)] # set a colour for each new speaker ax.barh(speaker, end - start, left=start, color=speaker_colors[speaker], height=0.4) # create horizontal bar plot ax.set_xlabel('Time (mins)') ax.set_ylabel('Speakers') ax.set_title('Speaker Timeline') ax.grid(True, which='both', linestyle='--', linewidth=0.5) plt.show()
Finally, call the plot_speaker_timeline function passing utterances as a parameter to see the plot image result.
plot_speaker_timeline(utterances)
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"AssemblyAI","description":"AssemblyAI provides production-ready Voice AI models for speech-to-text, speaker detection, sentiment analysis, and more. Build with pre-recorded or streaming audio using REST APIs and WebSockets.","colors":{"primary":"#614fd2","light":"#887bdd","dark":"#614fd2"},"logo":{"light":"https://mintcdn.com/assemblyai-fff14a6f/vMuNaI_PbWUbVeV0/assets/assemblyai-lockup-primary.svg?fit=max\u0026auto=format\u0026n=vMuNaI_PbWUbVeV0\u0026q=85\u0026s=808d2a677e2536423045d44b3f330ac2","dark":"https://mintcdn.com/assemblyai-fff14a6f/vMuNaI_PbWUbVeV0/assets/assemblyai-lockup-secondary.svg?fit=max\u0026auto=format\u0026n=vMuNaI_PbWUbVeV0\u0026q=85\u0026s=065ec1618693f8650241242ec62ed0ad","href":"https://www.assemblyai.com"},"favicon":"https://mintcdn.com/assemblyai-fff14a6f/6OQYF4QMRVQRoCb1/assets/favicon.png?fit=max\u0026auto=format\u0026n=6OQYF4QMRVQRoCb1\u0026q=85\u0026s=74b6b6a7321938bd113d4a271e06068d","api":{"openapi":["openapi.yaml","api-reference/specs/llm-gateway.yaml","api-reference/specs/streaming-token.yaml"],"asyncapi":["api-reference/specs/streaming.yaml","api-reference/specs/streaming-tts.yaml"]},"background":{"color":{"light":"#fdfcf8","dark":"#1d1b16"}},"navbar":{"links":[{"href":"https://www.assemblyai.com/playground","label":"Playground"},{"href":"https://www.assemblyai.com/changelog","label":"Changelog"}],"primary":{"type":"button","label":"Sign In","href":"https://www.assemblyai.com/dashboard/login"}},"footer":{"socials":{"x":"https://x.com/AssemblyAI","github":"https://github.com/AssemblyAI","linkedin":"https://www.linkedin.com/company/assemblyai"},"links":[{"header":"Legal","items":[{"label":"Terms of Service","href":"https://www.assemblyai.com/legal/terms-of-service"},{"label":"Privacy Policy","href":"https://www.assemblyai.com/legal/privacy-policy"},{"label":"Trust Center","href":"https://app.vanta.com/assemblyai/trust/7n80syl8zln1bn1qm3x8eg"},{"label":"Subprocessors","href":"https://app.vanta.com/assemblyai/trust/7n80syl8zln1bn1qm3x8eg/subprocessors"}]}]},"seo":{"metatags":{"canonical":"https://www.assemblyai.com/docs"}},"fonts":{"heading":{"family":"GT Standard","weight":600,"source":"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Semibold.woff2","format":"woff2"},"body":{"family":"GT Standard","weight":400,"source":"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Regular.woff2","format":"woff2"}},"icons":{"library":"fontawesome"},"banner":{"content":"**New** AssemblyAI-TTS-1: Text-to-speech for voice agents. [Learn more](https://www.assemblyai.com/docs/tts/getting-started/quickstart)","dismissible":true},"contextual":{"options":["copy","view","chatgpt","claude","download-spec"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"assemblyai-fff14a6f","hasAudioNarration":false,"actualSubdomain":"assemblyai-fff14a6f","customDomains":["assemblyai.com"],"gitSource":{"type":"github","owner":"assemblyai","repo":"assemblyai-docs","deployBranch":"master","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aee5de7268b355628b3cb0e","clientVersion":"0.0.4087","searchFilterCounts":[{"language":"default","tag":"Overview","count":114},{"language":"default","tag":"FAQ","count":93},{"language":"default","tag":"Pre-recorded STT","count":69},{"language":"default","tag":"Guides","count":59},{"language":"default","tag":"Real-time STT","count":50},{"language":"default","tag":"Tutorials","count":48},{"language":"default","tag":"Pre-recorded audio","count":47},{"language":"default","tag":"LLM Gateway","count":44},{"language":"default","tag":"Features","count":37},{"language":"default","tag":"API reference","count":35}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true,"attachments":{"status":"DISABLED"}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"@font-face{font-family:\"GT Standard\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Regular.woff2\")\n format(\"woff2\"),\n url(\"https://www.assemblyai.com/docs/assets/GT-Standard-M-Regular.woff2\")\n format(\"woff2\"),\n url(\"/assets/GT-Standard-M-Regular.woff2\") format(\"woff2\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"GT Standard\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Medium.woff2\")\n format(\"woff2\"),\n url(\"https://www.assemblyai.com/docs/assets/GT-Standard-M-Medium.woff2\")\n format(\"woff2\"),\n url(\"/assets/GT-Standard-M-Medium.woff2\") format(\"woff2\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"GT Standard\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Semibold.woff2\")\n format(\"woff2\"),\n url(\"https://www.assemblyai.com/docs/assets/GT-Standard-M-Semibold.woff2\")\n format(\"woff2\"),\n url(\"/assets/GT-Standard-M-Semibold.woff2\") format(\"woff2\");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Light.woff2\")\n format(\"woff2\");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Regular.woff2\")\n format(\"woff2\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Medium.woff2\")\n format(\"woff2\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Italic.woff2\")\n format(\"woff2\");font-weight:400;font-style:italic;font-display:swap}html:root{--font-family-body-custom: \"GT Standard\", -apple-system, BlinkMacSystemFont,\n \"Segoe UI\", sans-serif;--font-family-headings-custom: \"GT Standard\", -apple-system, BlinkMacSystemFont,\n \"Segoe UI\", sans-serif}code,kbd,samp,pre,pre code,pre code span{font-family:\"Modern Gothic Mono\", \"JetBrains Mono\", ui-monospace, SFMono-Regular,\n Menlo, Consolas, monospace!important}html{overflow-y:scroll;scrollbar-gutter:stable}pre,pre code,pre code span{font-size:0.75rem!important;line-height:1.5!important}:not(pre)>code{font-size:0.75rem!important;line-height:inherit!important}[data-nav-tag=\"WSS\"]{color:#614fd2!important;background-color:rgba(136, 123, 221, 0.14)!important;font-size:0.55rem!important}:is(.dark) [data-nav-tag=\"WSS\"]{color:#887bdd!important}div:has(>.nav-tag-pill>[data-nav-tag=\"WSS\"]){order:-1}.nav-tag-pill:has(>[data-nav-tag=\"WSS\"]){width:2.375rem;justify-content:flex-start}.ws-endpoint{display:flex;align-items:center;gap:0.625rem;margin:1rem 0 1.75rem;padding:0.5rem 0.75rem;border:1px solid rgba(0, 0, 0, 0.08);border-radius:0.5rem;background:rgba(0, 0, 0, 0.02);font-size:0.875rem;overflow-x:auto}:is(.dark) .ws-endpoint{border-color:rgba(255, 255, 255, 0.1);background:rgba(255, 255, 255, 0.03)}.ws-endpoint-badge{flex:none;font-weight:700;font-size:0.75rem;letter-spacing:0.02em;color:#614fd2;background:rgba(136, 123, 221, 0.14);padding:0.1875rem 0.5rem;border-radius:0.375rem}:is(.dark) .ws-endpoint-badge{color:#887bdd}.ws-endpoint-url{font-family:ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace;white-space:nowrap}#assistant-entry,:is(.dark) #assistant-entry{background-color:#614fd2!important;filter:none!important}#assistant-entry:hover,:is(.dark) #assistant-entry:hover{background-color:#614fd2!important;opacity:0.9;filter:none!important}#assistant-entry span,#assistant-entry svg,:is(.dark) #assistant-entry span,:is(.dark) #assistant-entry svg{color:#ffffff!important}.callout strong{font-weight:700}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-o-font-smoothing:antialiased}.katex-display{overflow-x:visible!important;overflow-y:visible!important}.katex-display>.katex{display:flex!important;justify-content:center;width:100%!important;overflow-x:visible!important;overflow-y:visible!important}.katex-display>.katex>.katex-html{display:inline-block!important;width:auto!important;max-width:100%;overflow-x:visible!important;overflow-y:visible!important}.card-logo-icon{display:block;width:1.5rem!important;height:1.5rem!important;min-width:1.5rem;max-width:1.5rem;max-height:1.5rem;margin:0!important;object-fit:contain;object-position:center;vertical-align:middle}.card-logo-icon-livekit{transform:scale(0.9)}.card-logo-icon-pipecat{transform:scale(1.12)}.card-logo-icon-livekit,.card-logo-icon-pipecat,.card-logo-icon-vercel{color:#614fd2}:is(.dark) .card-logo-icon-livekit,:is(.dark) .card-logo-icon-pipecat,:is(.dark) .card-logo-icon-vercel{color:#887bdd}.recommended-pill{background:#614fd2;color:#fff;padding:2px 8px;border-radius:9999px;font-size:0.7rem;font-weight:600;margin-left:6px;vertical-align:middle;white-space:nowrap}:is(.dark) .recommended-pill{background:#614fd2}.preview-pill{background:#b45309;color:#fff;padding:2px 8px;border-radius:9999px;font-size:0.7rem;font-weight:600;margin-left:6px;vertical-align:middle;white-space:nowrap}:is(.dark) .preview-pill{background:#b45309}table code{white-space:nowrap}"}],"page":{"pagePath":"pre-recorded-audio/guides/speaker_timeline","slug":"/pre-recorded-audio/guides/speaker_timeline","pageMetadata":{"title":"Plot A Speaker Timeline with Matplotlib","og.description":"Plot A Speaker Timeline with Matplotlib documentation.","description":null,"href":"/pre-recorded-audio/guides/speaker_timeline"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`In this guide, we’ll show you how to plot a speaker timeline with matplotlib, using results from the speaker diarization model.`}),`\n`,_jsx(Heading,{level:`2`,id:`quickstart`,children:`Quickstart`}),`\n`,_jsx(CodeBlock,{filename:``,expandable:`true`,numberOfLines:`32`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`32`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` assemblyai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aai`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` matplotlib.pyplot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`aai.settings.api_key `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"YOUR_API_KEY\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aai.TranscriptionConfig(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`speaker_labels`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`transcriber `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aai.Transcriber()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`transcript `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transcriber.transcribe(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./my-audio.mp3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, config)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`utterances `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transcript.utterances`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` plot_speaker_timeline`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`utterances`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fig, ax `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt.subplots(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`figsize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` colors `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'b'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'g'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'r'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'c'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'m'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'y'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'k'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker_colors `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterances:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` start `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance.start `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60000`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # in minutes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` end `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance.end `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60000`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # in minutes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance.speaker`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`not`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker_colors:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker_colors[speaker] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` colors[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(speaker_colors) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`%`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(colors)] `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# set a colour for each new speaker`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.barh(speaker, end `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` start, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`left`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`start, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`color`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`speaker_colors[speaker], `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`height`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# create horizontal bar plot`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.set_xlabel(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Time (mins)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.set_ylabel(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Speakers'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.set_title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Speaker Timeline'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.grid(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`which`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'both'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linestyle`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'--'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linewidth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt.show()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plot_speaker_timeline(utterances)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`get-started`,children:`Get Started`}),`\n`,_jsxs(_components.p,{children:[`Before we begin, make sure you have an AssemblyAI account and an API key. You can `,_jsx(_components.a,{href:`https://assemblyai.com/dashboard/signup`,children:`sign up`}),` for a free account and get your API key from your dashboard.`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-by-step-instructions`,children:`Step-by-Step Instructions`}),`\n`,_jsx(_components.p,{children:`Install the SDK.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -U`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` assemblyai`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -U`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` matplotlib`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Import the `,_jsx(_components.code,{children:`assemblyai`}),` package and set the API key.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` assemblyai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aai`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`aai.settings.api_key `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"YOUR_API_KEY\"`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Create a `,_jsx(_components.code,{children:`TranscriptionConfig`}),` object and set speaker labels to `,_jsx(_components.code,{children:`True`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aai.TranscriptionConfig(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`speaker_labels`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Create a `,_jsx(_components.code,{children:`Transcriber`}),` object.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`transcriber `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aai.Transcriber()`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Use the Transcriber object’s `,_jsx(_components.code,{children:`transcribe`}),` method and pass in the audio file’s path and `,_jsx(_components.code,{children:`config`}),` object as parameters. The transcribe method saves the results of the transcription to the `,_jsx(_components.code,{children:`Transcriber`}),` object’s `,_jsx(_components.code,{children:`transcript`}),` attribute.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`transcript `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transcriber.transcribe(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./my-audio.mp3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, config)`})]}),`\n`]})})}),`\n`,_jsx(Tip,{children:` Alternatively, you can use an audio URL available on the internet. `}),`\n`,_jsxs(_components.p,{children:[`Extract the utterances from the transcript and set this to `,_jsx(_components.code,{children:`utterances`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`utterances `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transcript.utterances`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Import the `,_jsx(_components.code,{children:`matplotlib.pyplot`}),` library. Then use the following `,_jsx(_components.code,{children:`plot_speaker_timeline`}),` function which results in a plot image of the speaker timeline. This function extracts the `,_jsx(_components.code,{children:`start`}),` and `,_jsx(_components.code,{children:`end`}),` timestamps of each `,_jsx(_components.code,{children:`utterance`}),` per `,_jsx(_components.code,{children:`speaker`}),` and plots the data onto the horizontal bar chart. The X and Y axis are labelled accordingly.`]}),`\n`,_jsx(CodeBlock,{filename:``,expandable:`true`,numberOfLines:`22`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` matplotlib.pyplot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` plot_speaker_timeline`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`utterances`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fig, ax `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt.subplots(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`figsize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`12`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` colors `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'b'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'g'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'r'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'c'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'m'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'y'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'k'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker_colors `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterances:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` start `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance.start `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60000`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # in minutes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` end `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance.end `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60000`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # in minutes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` utterance.speaker`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`not`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker_colors:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` speaker_colors[speaker] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` colors[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(speaker_colors) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`%`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(colors)] `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# set a colour for each new speaker`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.barh(speaker, end `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` start, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`left`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`start, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`color`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`speaker_colors[speaker], `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`height`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# create horizontal bar plot`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.set_xlabel(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Time (mins)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.set_ylabel(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Speakers'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.set_title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Speaker Timeline'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ax.grid(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`which`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'both'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linestyle`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'--'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linewidth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt.show()`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Finally, call the `,_jsx(_components.code,{children:`plot_speaker_timeline`}),` function passing `,_jsx(_components.code,{children:`utterances`}),` as a parameter to see the plot image result.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plot_speaker_timeline(utterances)`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Plot A Speaker Timeline with Matplotlib","og.description":"Plot A Speaker Timeline with Matplotlib documentation.","description":null,"href":"/pre-recorded-audio/guides/speaker_timeline"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Quickstart","slug":"quickstart","depth":2,"children":[{"title":"Get Started","slug":"get-started","depth":3,"children":[]},{"title":"Step-by-Step Instructions","slug":"step-by-step-instructions","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/assemblyai-fff14a6f/83628fb7cd91f870/rudderstack.js","/docs/_mintlify/custom/assemblyai-fff14a6f/700d2574de973df9/chat-widget.js"],"subdomain":"assemblyai-fff14a6f","siteName":"AssemblyAI","title":"Plot A Speaker Timeline with Matplotlib - AssemblyAI","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-06T22:04:46.629Z","originalFileLocation":"pre-recorded-audio/guides/speaker_timeline.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"AssemblyAI\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Plot A Speaker Timeline with Matplotlib - AssemblyAI\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"AssemblyAI\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://assemblyai-fff14a6f.mintlify.site/docs/_mintlify/api/og/v2?division=Speaker+labels\u0026amp;title=Plot+A+Speaker+Timeline+with+Matplotlib\u0026amp;theme=de66a831debd161b892ce587\u0026amp;signature=e5950d57891ab56a8a3ac45913c2cdeb0c238b396a3c828e8d5bb39b7236d200\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Plot A Speaker Timeline with Matplotlib - AssemblyAI\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://assemblyai-fff14a6f.mintlify.site/docs/_mintlify/api/og/v2?division=Speaker+labels\u0026amp;title=Plot+A+Speaker+Timeline+with+Matplotlib\u0026amp;theme=de66a831debd161b892ce587\u0026amp;signature=e5950d57891ab56a8a3ac45913c2cdeb0c238b396a3c828e8d5bb39b7236d200\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"AssemblyAI\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#614fd2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/pre-recorded-audio/guides/speaker_timeline.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.assemblyai.com/#organization\",\"name\":\"AssemblyAI\",\"url\":\"https://www.assemblyai.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/assemblyai-fff14a6f/vMuNaI_PbWUbVeV0/assets/assemblyai-lockup-primary.svg?fit=max\u0026auto=format\u0026n=vMuNaI_PbWUbVeV0\u0026q=85\u0026s=808d2a677e2536423045d44b3f330ac2\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.assemblyai.com/docs#website\",\"name\":\"AssemblyAI\",\"url\":\"https://www.assemblyai.com/docs\",\"publisher\":{\"@id\":\"https://www.assemblyai.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline#webpage\",\"url\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline\",\"name\":\"Plot A Speaker Timeline with Matplotlib\",\"dateModified\":\"2026-11-06T22:04:46.629Z\",\"isPartOf\":{\"@id\":\"https://www.assemblyai.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://www.assemblyai.com/docs/pre-recorded-audio/migration-guides/dg_to_aai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https://www.assemblyai.com/docs/meeting-notetaker-best-practices\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Speaker labels\",\"item\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/make-speaker-labels\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Plot A Speaker Timeline with Matplotlib\",\"item\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline#article\",\"headline\":\"Plot A Speaker Timeline with Matplotlib\",\"name\":\"Plot A Speaker Timeline with Matplotlib\",\"url\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline\",\"mainEntityOfPage\":{\"@id\":\"https://www.assemblyai.com/docs/pre-recorded-audio/guides/speaker_timeline#webpage\"},\"dateModified\":\"2026-11-06T22:04:46.629Z\",\"publisher\":{\"@id\":\"https://www.assemblyai.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.assemblyai.com/docs#website\"}}]}\u003c/script>","siteName":"AssemblyAI","nav":{"global":null,"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":""}]},{"tab":"Pre-recorded STT","groups":[{"group":"Getting started","pages":[{"title":"Quickstart","href":"/pre-recorded-audio/getting-started/transcribe-an-audio-file"},{"title":"Model selection","href":"/pre-recorded-audio/select-the-speech-model"}]},{"group":"Features","pages":[{"title":"Prompting and Keyterms","sidebarTitle":"Prompting and Keyterms","href":"/pre-recorded-audio/universal-3-5-pro/prompting"},{"title":"Medical Mode","href":"/pre-recorded-audio/medical-mode"},{"title":"Speaker Diarization","sidebarTitle":"Speaker Diarization","href":"/pre-recorded-audio/label-speakers"},{"title":"Multichannel Transcription","sidebarTitle":"Multichannel Transcription","href":"/pre-recorded-audio/transcribe-multiple-audio-channels"},{"title":"Code Switching","sidebarTitle":"Code Switching","href":"/pre-recorded-audio/code-switching"},{"group":"Languages","pages":[{"title":"Automatic Language Detection","sidebarTitle":"Detect language automatically","href":"/pre-recorded-audio/language-detection"},{"title":"Set Language Manually","sidebarTitle":"Set language manually","href":"/pre-recorded-audio/set-language-manually"},{"title":"Supported Languages","sidebarTitle":"Supported languages","href":"/pre-recorded-audio/supported-languages"}]},{"title":"Custom Spelling","sidebarTitle":"Custom Spelling","href":"/pre-recorded-audio/correct-spelling-of-terms"},{"title":"Formatting","sidebarTitle":"Formatting","href":"/pre-recorded-audio/formatting"},{"title":"Filler Words","sidebarTitle":"Filler Words","href":"/pre-recorded-audio/include-filler-words"},{"title":"Word Search","sidebarTitle":"Word Search","href":"/pre-recorded-audio/search-for-words-in-transcript"},{"title":"Set the Start and End of the Transcript","sidebarTitle":"Set the start and end of the transcript","href":"/pre-recorded-audio/set-the-start-and-end-of-the-transcript"},{"group":"Transcription operations","pages":[{"title":"Transcript Status","sidebarTitle":"Check transcript status","href":"/pre-recorded-audio/check-transcript-status"},{"title":"Transcript export options","sidebarTitle":"Export transcripts as SRT, VTT, or text","href":"/pre-recorded-audio/export-transcripts-as-srt-vtt-or-text"},{"title":"Delete Transcripts","sidebarTitle":"Delete transcripts","href":"/pre-recorded-audio/delete-transcripts"}]}]},{"group":"API reference","pages":[{"title":"Upload a media file","openapi":"openapi.yaml POST /v2/upload","href":"/pre-recorded-audio/api-reference/files/upload"},{"title":"Transcribe audio","openapi":"openapi.yaml POST /v2/transcript","href":"/pre-recorded-audio/api-reference/transcripts/submit"},{"title":"Get a transcript","openapi":"openapi.yaml GET /v2/transcript/{transcript_id}","href":"/pre-recorded-audio/api-reference/transcripts/get"},{"title":"Get transcript sentences","openapi":"openapi.yaml GET /v2/transcript/{transcript_id}/sentences","href":"/pre-recorded-audio/api-reference/transcripts/get-sentences"},{"title":"Get transcript paragraphs","openapi":"openapi.yaml GET /v2/transcript/{transcript_id}/paragraphs","href":"/pre-recorded-audio/api-reference/transcripts/get-paragraphs"},{"title":"Get subtitles","openapi":"openapi.yaml GET /v2/transcript/{transcript_id}/{subtitle_format}","href":"/pre-recorded-audio/api-reference/transcripts/get-subtitles"},{"title":"Get redacted audio","openapi":"openapi.yaml GET /v2/transcript/{transcript_id}/redacted-audio","href":"/pre-recorded-audio/api-reference/transcripts/get-redacted-audio"},{"title":"Word search","openapi":"openapi.yaml GET /v2/transcript/{transcript_id}/word-search","href":"/pre-recorded-audio/api-reference/transcripts/word-search"},{"title":"List transcripts","openapi":"openapi.yaml GET /v2/transcript","href":"/pre-recorded-audio/api-reference/transcripts/list"},{"title":"Delete a transcript","openapi":"openapi.yaml DELETE /v2/transcript/{transcript_id}","href":"/pre-recorded-audio/api-reference/transcripts/delete"}]},{"group":"Advanced","pages":[{"title":"Webhooks for pre-recorded audio","sidebarTitle":"Webhooks","href":"/pre-recorded-audio/webhooks"},{"title":"Benchmarks","sidebarTitle":"View model benchmarks","href":"/pre-recorded-audio/benchmarks"},{"title":"Evaluating Pre-recorded STT models","sidebarTitle":"Evaluate model accuracy","href":"/pre-recorded-audio/evaluations"},{"title":"Cloud Endpoints and Data Residency","sidebarTitle":"Cloud endpoints \u0026 data residency","href":"/pre-recorded-audio/select-the-region"},{"title":"Rate limits","sidebarTitle":"Manage rate limits","href":"/pre-recorded-audio/rate-limits"}]},{"group":"Guides","pages":[{"group":"Migration guides","expanded":false,"pages":[{"title":"Migration guide: Deepgram to AssemblyAI","sidebarTitle":"Migration guide Deepgram to AssemblyAI","href":"/pre-recorded-audio/migration-guides/dg_to_aai"},{"title":"Migration guide: OpenAI to AssemblyAI","sidebarTitle":"Migration guide OpenAI to AssemblyAI","href":"/pre-recorded-audio/migration-guides/oai_to_aai"},{"title":"Migration guide: AWS Transcribe to AssemblyAI","sidebarTitle":"Migration guide AWS Transcribe to AssemblyAI","href":"/pre-recorded-audio/migration-guides/aws_to_aai"},{"title":"Migration guide: Google Speech-to-Text to AssemblyAI","sidebarTitle":"Migration guide Google Speech-to-Text to AssemblyAI","href":"/pre-recorded-audio/migration-guides/google_to_aai"},{"title":"Migration guide: Gladia to AssemblyAI","sidebarTitle":"Migration guide Gladia to AssemblyAI","href":"/pre-recorded-audio/migration-guides/gladia_to_aai"}]},{"group":"Tutorials","expanded":false,"pages":[{"title":"Best Practices for building Meeting Notetakers","sidebarTitle":"Build a meeting notetaker","href":"/meeting-notetaker-best-practices"},{"title":"Build a medical scribe","href":"/medical-scribe-best-practices"},{"title":"Best Practices for building Contact Center Applications","sidebarTitle":"Build a contact center application","href":"/contact-center-best-practices"},{"group":"Basic transcription workflows","pages":[{"title":"Get YouTube Video Transcripts with yt-dlp","href":"/pre-recorded-audio/guides/transcribe_youtube_videos"},{"title":"Build a UI for Transcription with Gradio and Python","href":"/pre-recorded-audio/guides/gradio-frontend"},{"title":"Detect Low Confidence Words in a Transcript","href":"/pre-recorded-audio/guides/detecting-low-confidence-words"}]},{"group":"Batch transcription","pages":[{"title":"Running Bulk Transcription and Load Tests at Scale","href":"/pre-recorded-audio/guides/bulk-transcription-and-load-tests-at-scale"},{"title":"Transcribe Multiple Files Simultaneously Using the JavaScript SDK","href":"/pre-recorded-audio/guides/sdk-node-batch"},{"title":"Transcribe Multiple Files Simultaneously Using the Python SDK","href":"/pre-recorded-audio/guides/batch_transcription"}]},{"group":"Hosting audio files","pages":[{"title":"Transcribe from an S3 Bucket","href":"/pre-recorded-audio/guides/transcribe_from_s3"},{"title":"Transcribe Google Drive Files","sidebarTitle":"Transcribe a Google Drive File","href":"/pre-recorded-audio/guides/transcribing-google-drive-file"},{"title":"Transcribe GitHub Files","href":"/pre-recorded-audio/guides/transcribing-github-files"}]},{"group":"Speaker labels","pages":[{"title":"Iterate over Speaker Labels with Make.com","href":"/pre-recorded-audio/guides/make-speaker-labels"},{"title":"Calculate the Talk / Listen Ratio of Speakers","description":null,"href":"/pre-recorded-audio/guides/talk-listen-ratio"},{"title":"Plot A Speaker Timeline with Matplotlib","href":"/pre-recorded-audio/guides/speaker_timeline"},{"title":"Generate Custom Speaker Labels with Pyannote","description":null,"href":"/pre-recorded-audio/guides/Use_AssemblyAI_with_Pyannote_to_generate_custom_Speaker_Labels"},{"title":"Use Speaker Diarization with Async Chunking","href":"/pre-recorded-audio/guides/speaker-diarization-with-async-chunking"},{"title":"Setup A Speaker Identification System using Pinecone \u0026 Nvidia TitaNet","href":"/pre-recorded-audio/guides/titanet-speaker-identification"}]},{"group":"Automatic Language Detection","pages":[{"title":"Use Automatic Language Detection as a Separate Step From Transcription","href":"/pre-recorded-audio/guides/automatic-language-detection-separate"},{"title":"Route to Default Language if Language Confidence is Low","href":"/pre-recorded-audio/guides/automatic-language-detection-route-default-language"}]},{"group":"Subtitles","pages":[{"title":"Create Custom Length Subtitles","href":"/pre-recorded-audio/guides/subtitle_creation_by_word_count"},{"title":"Create Subtitles with Speaker Labels","href":"/pre-recorded-audio/guides/speaker_labelled_subtitles"},{"title":"Generate Subtitles for Videos","href":"/pre-recorded-audio/guides/subtitles"},{"title":"Translate an AssemblyAI Subtitle Transcript","href":"/pre-recorded-audio/guides/translate_subtitles"}]},{"group":"Delete transcripts","pages":[{"title":"Schedule a DELETE request with AssemblyAI and EasyCron","href":"/pre-recorded-audio/guides/schedule_delete"}]},{"group":"Error handling and audio file fixes","pages":[{"title":"Troubleshoot Common Errors","href":"/pre-recorded-audio/guides/common_errors_and_solutions"},{"title":"Implement Retry Server Error Logic","href":"/pre-recorded-audio/guides/retry-server-error"},{"title":"Implement Retry Upload Error Logic","href":"/pre-recorded-audio/guides/retry-upload-error"},{"title":"Identify Duplicate Dual Channel Files","href":"/pre-recorded-audio/guides/identify_duplicate_channels"},{"title":"Correct Audio Duration Discrepancies with Multi-Tool Validation and Transcoding","href":"/pre-recorded-audio/guides/audio-duration-fix"},{"title":"Audio File Downsampling Recommendations and Best Practices","href":"/pre-recorded-audio/guides/downsampling"}]},{"group":"Translation","pages":[{"title":"Translate an AssemblyAI Subtitle Transcript","href":"/pre-recorded-audio/guides/translate_subtitles"},{"title":"Translate AssemblyAI Transcripts Into Other Languages Using Commercial Models","href":"/pre-recorded-audio/guides/translate_transcripts"},{"title":"Transform Chinese transcripts into Simplified or Traditional Text","href":"/pre-recorded-audio/guides/traditional_simplified_chinese"}]},{"group":"Do more with our SDKs","pages":[{"title":"Do More With Our SDKs","href":"/pre-recorded-audio/guides/do-more-with-sdk"}]}]}]}]},{"tab":"Real-time STT","pages":[{"title":"Real-time STT","href":"/streaming/getting-started/transcribe-streaming-audio"}]},{"tab":"Sync STT","pages":[{"title":"Sync STT","href":"/sync-stt/getting-started/quickstart"}]},{"tab":"Dictation API","pages":[{"title":"Dictation API","href":"/dictation"}]},{"tab":"Text to Speech","pages":[{"title":"Text to Speech","href":"/tts/getting-started/quickstart"}]},{"tab":"Voice Agent API","hidden":true,"pages":[{"title":"Voice Agent API","href":"/voice-agents/voice-agent-api"}]},{"tab":"Speech Understanding","pages":[{"title":"Speech Understanding","href":"/speech-understanding/getting-started"}]},{"tab":"Guardrails","pages":[{"title":"Guardrails","href":"/guardrails/getting-started"}]},{"tab":"LLM Gateway","pages":[{"title":"LLM Gateway","href":"/llm-gateway/quickstart"}]},{"tab":"FAQ","pages":[{"title":"FAQ","href":"/faq"}]}]},"basePath":"","title":"Plot A Speaker Timeline with Matplotlib - AssemblyAI","buildId":"dpl_BSPUBxEoKhhK7HzXVDPxdPvWx4xc","deploymentId":"dpl_BSPUBxEoKhhK7HzXVDPxdPvWx4xc","dynamics":["10e4515597"],"chunks":["BannerMarkdown--rjwFo9x.js","dist-qmLwQyWY.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-apD-Q0Oo.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}