async start() | Starts the session and returns once Simli has started it. Raises a SimliError if it can’t. |
async stop() | Ends the session and closes the connection. |
async send(data: bytes | str) | Sends PCM16, 16 kHz, mono audio, or a control message. Raises once the session has ended. |
async sendImmediate(data: bytes) | Drops any queued audio and plays this right away. |
async sendSilence(duration: float = 0.1875) | Sends that many seconds of silence. |
async clearBuffer() | Drops any queued audio, so the avatar stops talking. |
async setCamera(camera: CameraSetting | None, *, lerp_seconds: float | None = None) | Trinity-2 only. Replaces the camera, or goes back to the avatar’s own framing with None. Glides over lerp_seconds seconds if it’s above 0, otherwise cuts. Raises ValueError on a NaN or infinite value. See Trinity-2. |
async setBackground(background_id: str | None) | Trinity-2 only. Shows one of your uploaded backgrounds behind the avatar, or the avatar’s own with None. Raises ValueError if the id isn’t a 36-character id. |
async setForeground(foreground_id: str | None) | Trinity-2 only. Lays one of your uploaded foregrounds over the avatar, or removes it with None. Raises ValueError if the id isn’t a 36-character id. |
getVideoStreamIterator(targetFormat: str = "rgb24") | An async iterator over the video, as PyAV VideoFrames in targetFormat. |
getAudioStreamIterator(targetSampleRate: int = 48000) | An async iterator over the audio, as PyAV AudioFrames, resampled to targetSampleRate. |
registerEventCallback(event: SimliEvent, async_callback) | Calls async_callback() on an event. Register after start(). |