Documentation Index
Fetch the complete documentation index at: https://docs.mascot.bot/llms.txt
Use this file to discover all available pages before exploring further.
createStreamingSession() is the low-level streaming primitive on
LipsyncClient. You feed it fixed-size audio windows and it returns one
viseme result per window. Most React apps should use
useLipsyncStream instead — it owns the audio
graph for you. Reach for the raw session when you control the audio source
yourself (a custom worklet, a Node pipeline, a non-React app).
The window contract
| Rule | Detail |
|---|---|
| Sample rate | 16 kHz mono. Use client.resample(buf, fromRate, 16000) upstream. |
| Window size | 400 samples — exactly 25 ms. |
| Cadence | One window at a time, in order. pushWindow is async — await each. |
| Cleanup | session.close() when the utterance/stream ends. |
pushWindow resolves to a LipsyncStreamingFrameResult:
Drive the avatar
Append each result to a streamingMascotPlayback. offset is the
audio-position in ms; the playback’s animation-frame clock fires the viseme
when its time arrives.
Silence handling
silenceDetected reflects the SDK’s internal −50 dBFS input-amplitude
silence gate. It suppresses the phantom mouth shapes a naive pipeline would
emit during the inference tail after speech stops — you do not implement your
own gate. Treat silenceDetected: true windows as “mouth at rest”.
Barge-in and interruption
To cut a response short (the user interrupts), stop feeding windows and reset playback:createPCMStreamPlayer (which plays it
gap-tolerantly and exposes a MediaStream) with useLipsyncStream rather
than hand-windowing — that handles buffering and the tap for you.
React equivalent
useLipsyncStream({ source: { kind: "manual" } }) wraps a streaming session
and exposes pushAudio / pushBase64PCM16 / reset, while keeping the audio
graph stable across renders. Prefer it in React; use the raw session only when
you need full control of the window loop.
Next
Core client
init, processAudio, events.PCM stream player
Play + tap raw PCM.
Streaming & mic (React)
The React wrapper.