Skip to main content
Avatar speech audio is the audio the Avatar should speak, usually TTS output from a voice-agent pipeline. It is not the user’s microphone audio. Motion Server uses this audio to generate synchronized motion data. AvatarKit plays the speech audio locally while rendering the resulting motion.

Send timing

Send each new audio chunk when it is generated. Do not delay chunks to match wall-clock playback time. Motion Server needs enough audio to generate the next motion window before AvatarKit consumes the current one. TTS output usually arrives faster than playback, allowing both buffers to stay ahead.
Do not feed audio that is already arriving at 1x playback speed back into Spatius chunk by chunk. The current segment can finish before the next synchronized segment is ready, causing playback to stall.

If your source is paced

If 1x playback-speed audio is your only source, pre-buffer it before forwarding it. Start each speech turn with enough buffered audio for Motion Server to remain ahead, then continue filling that buffer while sending. This adds startup latency but avoids repeated playback gaps. Reset the buffer when a turn is interrupted or a new turn begins.

Input format

The canonical input is mono 16-bit PCM (s16le) at the sample rate configured for the avatar view. Convert source audio first when its channels, encoding, or sample rate do not match. The audio format belongs to each avatar view, not to SDK initialization, so two views can run different sample rates. It can also be changed on a live view; a change interrupts the current turn and, in Direct Mode, disconnects, so reconnect before sending audio in the new format. Some SDK entry points also accept Opus. Format support and configuration differ by platform and integration, so use the exact SDK reference rather than mixing PCM and Opus within one session: Web · iOS · Android · Flutter

End input or interrupt

These actions have different meanings:
  • End input marks the final chunk of the current speech turn. Motion Server can finalize that turn, and AvatarKit continues playing the buffered result.
  • Interrupt cancels the active turn and clears queued audio and motion data. Use it for barge-in or when the response should stop immediately.
Do not use interruption as the normal end marker for every response.