speak takes a URL, an ArrayBuffer or a Blob, in any format the browser can decode (MP3, WAV, Ogg, AAC…). The clip is analysed in full before it starts (in roughly 1% of its duration), then played with no added delay.
await avatar.speak("/greeting.mp3"); // resolves when the clip ends or is stoppedawait avatar.speak(await ttsResponse.blob()); // e.g. straight from a TTS APIavatar.stopSpeaking();
The stream plays streamDelayMs (default 150 ms) late. The model hears each sound that long before the listener does, so the mouth can move into it on time. Lower it for less latency, at the cost of rougher lip sync:
new TalkingAvatar({ container, avatarUrl, streamDelayMs: 80 });
Find the remote audio MediaStreamTrack and pass new MediaStream([track]):
function onTrack(event) { if (event.track.kind !== "audio") return; avatar.attachStream(new MediaStream([event.track])).catch(console.error);}pc.addEventListener("track", onTrack);// When leaving the conversation:// pc.removeEventListener("track", onTrack);// avatar.detachStream();// avatar.dispose();
The avatar knows when it’s speaking from its own audio. In between, it looks like it’s listening: attentive brows and a relaxed blink rate. While your agent is working on a reply, show it thinking:
avatar.setStatus("thinking"); // e.g. after the user stops talkingavatar.setStatus("listening"); // back to the default
Speech detected in the audio always takes priority over the status.
Use TTS voices for the best lip sync. The model was trained on clean, clearly articulated read speech, which is what TTS engines produce. Real voices, such as from a microphone, also work, but with background noise, echo or unclear speech the lip sync is less accurate.
One audio source at a time per avatar: attaching a stream replaces the previous one. A clip and a stream can overlap.
The avatar plays the audio. It can’t lip sync audio that’s played somewhere else without also playing it.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Talking Avatar","description":"Realistic talking avatars for voice agents, no-code AI voice agents, and a free open-source 3D talking avatar for the browser.","colors":{"primary":"#5B50D6","light":"#8E85F2","dark":"#463CC0"},"logo":{"light":"https://mintcdn.com/talking-avatar-dev/XqO5mCje4YpyAVum/logo/light.png?fit=max\u0026auto=format\u0026n=XqO5mCje4YpyAVum\u0026q=85\u0026s=854bf1c09eeeda085b9cbc8f69233292","dark":"https://mintcdn.com/talking-avatar-dev/XqO5mCje4YpyAVum/logo/dark.png?fit=max\u0026auto=format\u0026n=XqO5mCje4YpyAVum\u0026q=85\u0026s=30fb5eebac1f8074448a1834e6cb7bd5","href":"https://talking-avatar.dev"},"favicon":"https://mintcdn.com/talking-avatar-dev/XqO5mCje4YpyAVum/favicon.svg?fit=max\u0026auto=format\u0026n=XqO5mCje4YpyAVum\u0026q=85\u0026s=371e30ce3bd4e77ac5ec8e1a9dd7fd7c","api":{"playground":{"display":"interactive"},"mdx":{"auth":{"method":"bearer"},"server":"https://backend.talking-avatar.dev/api/talking-avatar"}},"background":{"color":{"light":"#FCFCFD","dark":"#0F0E1A"}},"navbar":{"links":[{"href":"https://talking-avatar.dev/demo","label":"Live demo"},{"href":"mailto:support@talking-avatar.dev","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.talking-avatar.dev"}},"footer":{"socials":{"github":"https://github.com/interviewflowai/talking-avatar","website":"https://talking-avatar.dev"}},"seo":{"metatags":{"og:site_name":"Talking Avatar Docs"}},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://talking-avatar.dev"},{"anchor":"GitHub","icon":"github","href":"https://github.com/interviewflowai/talking-avatar"},{"anchor":"npm","icon":"npm","href":"https://www.npmjs.com/package/@interviewflowai/talking-avatar"},{"anchor":"Slack community","icon":"slack","href":"https://join.slack.com/t/talking-avatar/shared_invite/zt-4e3u9h2ts-JqpSZc~U1ScpKM_IrOq9Ow"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"talking-avatar-dev","hasAudioNarration":false,"actualSubdomain":"talking-avatar-dev","customDomains":["docs.talking-avatar.dev"],"gitSource":{"type":"github","owner":"tushar1357","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":"","_id":"6adf4e40d9bc4ba6afb7e61a"},"chroma":{"latestBuiltDeploymentHistoryId":"6adf525c97503f50adc617d5","collectionId":"1790e0ab-6087-4800-aa9b-92bae0caf0fa","liveDeploymentHistoryId":"6adf525c97503f50adc617d5","schemaVersion":"v3"},"entitlements":{},"buildId":"6adf525c97503f50adc617d5","clientVersion":"0.0.3966","searchFilterCounts":[{"language":"default","tag":"Guides","count":42},{"language":"default","tag":"Voice Agents (no code)","count":12},{"language":"default","tag":"API reference","count":11},{"language":"default","tag":"Realistic Avatars (API)","count":10},{"language":"default","tag":"Open Source (3D, free)","count":7},{"language":"default","tag":"SDK reference","count":7},{"language":"default","tag":"Your account","count":5},{"language":"default","tag":"Realtime avatar API","count":4},{"language":"default","tag":"Get started","count":4},{"language":"default","tag":"Help","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":true,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"open-source/audio-sources","slug":"/open-source/audio-sources","pageMetadata":{"title":"Audio sources","description":"Lip sync audio clips, live streams, microphones and WebRTC voice agents.","icon":"waveform-lines","href":"/open-source/audio-sources"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Lip sync audio clips, live streams, microphones and WebRTC voice agents.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"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={code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tab,Tabs,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The avatar lip syncs any audio you give it, and plays that audio itself. There are two inputs.`}),`\n`,_jsx(Heading,{level:`2`,id:`audio-clips`,children:`Audio clips`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`speak`}),` takes a URL, an `,_jsx(_components.code,{children:`ArrayBuffer`}),` or a `,_jsx(_components.code,{children:`Blob`}),`, in any format the browser can decode (MP3, WAV, Ogg, AAC…). The clip is analysed in full before it starts (in roughly 1% of its duration), then played with no added delay.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`speak`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/greeting.mp3\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// resolves when the clip ends or is stopped`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`speak`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ttsResponse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`blob`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// e.g. straight from a TTS API`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stopSpeaking`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Calling `,_jsx(_components.code,{children:`speak`}),` again stops the current clip.`]}),`\n`,_jsx(Heading,{level:`2`,id:`live-audio-streams`,children:`Live audio streams`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`attachStream`}),` takes any `,_jsx(_components.code,{children:`MediaStream`}),` with an audio track: a WebRTC remote stream, `,_jsx(_components.code,{children:`getUserMedia`}),`, or `,_jsx(_components.code,{children:`element.captureStream()`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`attachStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`stream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// plays it and lip syncs it`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`detachStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// stop`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Attaching a new stream replaces the previous one. `,_jsx(_components.code,{children:`detachStream`}),` doesn’t stop the source track; whoever owns it does.`]}),`\n`,_jsx(Heading,{level:`3`,id:`stream-delay`,children:`Stream delay`}),`\n`,_jsxs(_components.p,{children:[`The stream plays `,_jsx(_components.code,{children:`streamDelayMs`}),` (default `,_jsx(_components.strong,{children:`150 ms`}),`) late. The model hears each sound that long before the listener does, so the mouth can move into it on time. Lower it for less latency, at the cost of rougher lip sync:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` TalkingAvatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`container`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`avatarUrl`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`streamDelayMs:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 80`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`voice-agents`,children:`Voice agents`}),`\n`,_jsxs(_components.p,{children:[`Give the agent’s incoming audio to `,_jsx(_components.code,{children:`attachStream`}),` `,_jsx(_components.strong,{children:`instead of`}),` playing it in an `,_jsx(_components.code,{children:`\u003caudio>`}),` element.`]}),`\n`,_jsxs(Tabs,{children:[_jsx(Tab,{title:`OpenAI Realtime (WebRTC)`,id:`openai-realtime-webrtc`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` pc`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` RTCPeerConnection`}),_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\":`#9CDCFE`},children:`pc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`ontrack`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`attachStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`streams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]);`})]}),`\n`]})})})}),_jsxs(Tab,{title:`LiveKit`,id:`livekit`,children:[_jsxs(_components.p,{children:[`With `,_jsx(_components.code,{children:`livekit-client`}),`, for example with LiveKit Agents:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`7`,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:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RoomEvent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"livekit-client\"`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`room`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RoomEvent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`TrackSubscribed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\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:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`kind`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Kind`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Audio`}),_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\":`#9CDCFE`},children:` avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`attachStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` MediaStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`([`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mediaStreamTrack`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// don't call track.attach()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_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:`});`})}),`\n`]})})})]}),_jsxs(Tab,{title:`Daily`,id:`daily`,children:[_jsxs(_components.p,{children:[`With `,_jsx(_components.code,{children:`@daily-co/daily-js`}),`, for example with Pipecat:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`call`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"track-started\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, ({ `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`participant`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\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:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`kind`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"audio\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`participant`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`local`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`attachStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` MediaStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`([`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_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:`});`})}),`\n`]})})})]}),_jsxs(Tab,{title:`Any WebRTC stack`,id:`any-webrtc-stack`,children:[_jsxs(_components.p,{children:[`Find the remote audio `,_jsx(_components.code,{children:`MediaStreamTrack`}),` and pass `,_jsx(_components.code,{children:`new MediaStream([track])`}),`:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onTrack`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\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:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`kind`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"audio\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_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\":`#9CDCFE`},children:` avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`attachStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` MediaStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`([`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_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:`}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`pc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`addEventListener`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"track\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onTrack`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// When leaving the conversation:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// pc.removeEventListener(\"track\", onTrack);`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// avatar.detachStream();`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// avatar.dispose();`})}),`\n`]})})})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`microphone`,children:`Microphone`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` mic`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` navigator`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mediaDevices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getUserMedia`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`audio:`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`attachStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mic`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The avatar plays the microphone back, so use headphones to avoid echo. Live audio needs HTTPS (or `,_jsx(_components.code,{children:`localhost`}),`).`]}),`\n`,_jsx(Heading,{level:`2`,id:`listening-and-thinking`,children:`Listening and thinking`}),`\n`,_jsx(_components.p,{children:`The avatar knows when it’s speaking from its own audio. In between, it looks like it’s listening: attentive brows and a relaxed blink rate. While your agent is working on a reply, show it thinking:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`javascript`,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:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`setStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"thinking\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// e.g. after the user stops talking`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`avatar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`setStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"listening\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// back to the default`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Speech detected in the audio always takes priority over the status.`}),`\n`,_jsx(Heading,{level:`2`,id:`best-results`,children:`Best results`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Use TTS voices for the best lip sync.`}),` The model was trained on clean, clearly articulated read speech, which is what TTS engines produce. Real voices, such as from a microphone, also work, but with background noise, echo or unclear speech the lip sync is less accurate.`]})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`One audio source at a time`}),` per avatar: attaching a stream replaces the previous one. A clip and a stream can overlap.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`The avatar plays the audio.`}),` It can’t lip sync audio that’s played somewhere else without also playing it.`]}),`\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":"Audio sources","description":"Lip sync audio clips, live streams, microphones and WebRTC voice agents.","icon":"waveform-lines","href":"/open-source/audio-sources"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Audio clips","slug":"audio-clips","depth":2,"children":[]},{"title":"Live audio streams","slug":"live-audio-streams","depth":2,"children":[{"title":"Stream delay","slug":"stream-delay","depth":3,"children":[]}]},{"title":"Voice agents","slug":"voice-agents","depth":2,"children":[]},{"title":"Microphone","slug":"microphone","depth":2,"children":[]},{"title":"Listening and thinking","slug":"listening-and-thinking","depth":2,"children":[]},{"title":"Best results","slug":"best-results","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"talking-avatar-dev","siteName":"Talking Avatar","title":"Audio sources - Talking Avatar","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-26T13:00:09.903Z","originalFileLocation":"open-source/audio-sources.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=\"description\" content=\"Lip sync audio clips, live streams, microphones and WebRTC voice agents.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Talking Avatar\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_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=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Audio sources - Talking Avatar\">\u003cmeta data-mint-head property=\"og:description\" content=\"Lip sync audio clips, live streams, microphones and WebRTC voice agents.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Talking Avatar Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.talking-avatar.dev/open-source/audio-sources\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://talking-avatar-dev.mintlify.app/_mintlify/api/og/v2?division=Open+Source+%283D%2C+free%29\u0026amp;title=Audio+sources\u0026amp;description=Lip+sync+audio+clips%2C+live+streams%2C+microphones+and+WebRTC+voice+agents.\u0026amp;theme=58e53878a18f15cc753a260e\u0026amp;signature=759ffa947ee2bc882516a37d623c7484bd3f64871ce955d40d6480d0c51d1ac7\">\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=\"Audio sources - Talking Avatar\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Lip sync audio clips, live streams, microphones and WebRTC voice agents.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://talking-avatar-dev.mintlify.app/_mintlify/api/og/v2?division=Open+Source+%283D%2C+free%29\u0026amp;title=Audio+sources\u0026amp;description=Lip+sync+audio+clips%2C+live+streams%2C+microphones+and+WebRTC+voice+agents.\u0026amp;theme=58e53878a18f15cc753a260e\u0026amp;signature=759ffa947ee2bc882516a37d623c7484bd3f64871ce955d40d6480d0c51d1ac7\">\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=\"/mintlify-assets/_mintlify/favicons/talking-avatar-dev/zAkMraVcQjMTumKa/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Talking Avatar\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5B50D6\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.talking-avatar.dev/open-source/audio-sources\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/open-source/audio-sources.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.talking-avatar.dev/#organization\",\"name\":\"Talking Avatar\",\"url\":\"https://docs.talking-avatar.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/talking-avatar-dev/XqO5mCje4YpyAVum/logo/light.png?fit=max\u0026auto=format\u0026n=XqO5mCje4YpyAVum\u0026q=85\u0026s=854bf1c09eeeda085b9cbc8f69233292\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.talking-avatar.dev#website\",\"name\":\"Talking Avatar\",\"url\":\"https://docs.talking-avatar.dev\",\"publisher\":{\"@id\":\"https://docs.talking-avatar.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.talking-avatar.dev/open-source/audio-sources#webpage\",\"url\":\"https://docs.talking-avatar.dev/open-source/audio-sources\",\"name\":\"Audio sources\",\"description\":\"Lip sync audio clips, live streams, microphones and WebRTC voice agents.\",\"dateModified\":\"2026-10-26T13:00:09.903Z\",\"isPartOf\":{\"@id\":\"https://docs.talking-avatar.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.talking-avatar.dev/open-source/audio-sources#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.talking-avatar.dev/open-source/audio-sources#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Open Source (3D, free)\",\"item\":\"https://docs.talking-avatar.dev/open-source/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Audio sources\",\"item\":\"https://docs.talking-avatar.dev/open-source/audio-sources\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.talking-avatar.dev/open-source/audio-sources#article\",\"headline\":\"Audio sources\",\"name\":\"Audio sources\",\"description\":\"Lip sync audio clips, live streams, microphones and WebRTC voice agents.\",\"url\":\"https://docs.talking-avatar.dev/open-source/audio-sources\",\"mainEntityOfPage\":{\"@id\":\"https://docs.talking-avatar.dev/open-source/audio-sources#webpage\"},\"dateModified\":\"2026-10-26T13:00:09.903Z\",\"publisher\":{\"@id\":\"https://docs.talking-avatar.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.talking-avatar.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Talking Avatar\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Talking Avatar","nav":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://talking-avatar.dev"},{"anchor":"GitHub","icon":"github","href":"https://github.com/interviewflowai/talking-avatar"},{"anchor":"npm","icon":"npm","href":"https://www.npmjs.com/package/@interviewflowai/talking-avatar"},{"anchor":"Slack community","icon":"slack","href":"https://join.slack.com/t/talking-avatar/shared_invite/zt-4e3u9h2ts-JqpSZc~U1ScpKM_IrOq9Ow"}]},"tabs":[{"tab":"Guides","groups":[{"group":"Get started","pages":[{"title":"Introduction","icon":"house","href":""},{"title":"Quickstart","icon":"rocket","href":"/get-started/quickstart"},{"title":"Choose a product","icon":"signs-post","href":"/get-started/choose-a-product"},{"title":"Pricing","icon":"credit-card","href":"/get-started/pricing"}]},{"group":"Your account","pages":[{"title":"Create an account and sign in","icon":"user-plus","href":"/dashboard/sign-up"},{"title":"Dashboard tour","icon":"table-columns","href":"/dashboard/overview"},{"title":"API keys","icon":"key","href":"/dashboard/api-keys"},{"title":"Usage","icon":"chart-line","href":"/dashboard/usage"},{"title":"Billing and credits","icon":"wallet","href":"/dashboard/billing"}]},{"group":"Voice Agents (no code)","pages":[{"title":"Voice Agents overview","icon":"wand-magic-sparkles","href":"/voice-agents/overview"},{"title":"Create a voice agent","icon":"plus","href":"/voice-agents/create-an-agent"},{"title":"Templates","icon":"copy","href":"/voice-agents/templates"},{"title":"Write a good prompt","icon":"pen-to-square","href":"/voice-agents/prompting"},{"title":"Avatar and voice","icon":"user","href":"/voice-agents/avatar-and-voice"},{"title":"Conversation settings","icon":"comments","href":"/voice-agents/conversation-settings"},{"title":"Tools","icon":"wrench","href":"/voice-agents/tools"},{"title":"Post-call webhook","icon":"webhook","href":"/voice-agents/webhooks"},{"title":"Share and embed","icon":"share-nodes","href":"/voice-agents/share-and-embed"},{"title":"Private agents","icon":"lock","href":"/voice-agents/private-agents"},{"title":"Calls and transcripts","icon":"phone","href":"/voice-agents/calls"},{"title":"What callers see","icon":"mobile-screen","href":"/voice-agents/caller-experience"}]},{"group":"Realistic Avatars (API)","pages":[{"title":"Realistic Avatars overview","icon":"code","href":"/realistic-avatars/overview"},{"title":"Quickstart","icon":"rocket","href":"/realistic-avatars/quickstart"},{"title":"LiveKit","icon":"tower-broadcast","href":"/realistic-avatars/livekit"},{"title":"Stream audio","icon":"waveform-lines","href":"/realistic-avatars/streaming-audio"},{"title":"Interruptions and speech events","icon":"hand","href":"/realistic-avatars/interruptions"},{"title":"Sessions and errors","icon":"circle-exclamation","href":"/realistic-avatars/sessions"},{"title":"Avatars","icon":"users","href":"/realistic-avatars/avatars"},{"title":"Custom avatars","icon":"wand-magic-sparkles","href":"/realistic-avatars/custom-avatars"},{"title":"Set up with a coding agent","icon":"robot","href":"/realistic-avatars/coding-agent"},{"title":"Production checklist","icon":"list-check","href":"/realistic-avatars/production-checklist"}]},{"group":"Open Source (3D, free)","pages":[{"title":"Open Source overview","icon":"github","href":"/open-source/overview"},{"title":"Quickstart","description":"Install the open-source SDK and make your 3D avatar talk.","icon":"rocket","href":"/open-source/quickstart"},{"title":"Audio sources","icon":"waveform-lines","href":"/open-source/audio-sources"},{"title":"3D avatars","description":"What your .glb avatar needs, and how to map other morph target names.","icon":"cube","href":"/open-source/avatars"},{"title":"Self-host the model","icon":"server","href":"/open-source/self-hosting-the-model"},{"title":"How it works","icon":"gears","href":"/open-source/how-it-works"},{"title":"Troubleshooting","icon":"screwdriver-wrench","href":"/open-source/troubleshooting"}]},{"group":"Help","pages":[{"title":"Troubleshooting","icon":"screwdriver-wrench","href":"/help/troubleshooting"},{"title":"FAQ","icon":"circle-question","href":"/help/faq"},{"title":"Security and privacy","icon":"shield-halved","href":"/help/security-and-privacy"},{"title":"Support","icon":"life-ring","href":"/help/support"}]}]},{"tab":"SDK reference","pages":[{"title":"SDK reference","href":"/sdk/installation"}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/api-reference/introduction"}]}]},"title":"Audio sources - Talking Avatar","buildId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","deploymentId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","dynamics":[],"chunks":[]}