Skip to main content
@mascotbot/core is the framework-agnostic engine — no React, no Rive on the root entry. Use it in vanilla apps, Web Workers, or Node-adjacent environments. React apps get all of this re-exported through @mascotbot/react.

Initialize

init exchanges your key with the edge worker and loads the WASM runtime. Configuration mirrors <MascotProvider>.

processAudio(samples, opts?)

One-shot inference over a recorded buffer. samples is 16 kHz mono Float32 in [-1, 1]; pass opts.sampleRate if your buffer is at another rate and let the client resample.
timeline is the offline artifact — persist it as JSON and replay later with zero reprocessing (Offline lip sync).

resample(samples, fromSampleRate, toSampleRate?)

Linear resampler to prep audio for processAudio / streaming. toSampleRate defaults to 16000.

createStreamingSession()

For live audio, push 25 ms (400-sample) windows of 16 kHz mono one at a time.
pushWindow is async by design (inference is off the main thread). End-of- utterance phantom visemes are suppressed by the SDK’s internal −50 dBFS silence gate. Full streaming guide, including the React wrapper: Streaming sessions.

Events

client.on(event, listener) returns an unsubscribe function.
client.status is the current LipsyncStatus (idle | initializing | ready | running | degraded | refused | error).

diagnostics()

Async — resolves to an opaque health snapshot. Useful for a debug panel. Always await it (it is computed off-thread):

Teardown

Call one of these when you are finished so resources and the audio graph are released.

Vanilla Rive playback

The Rive engine lives on the /rive subpath. Construct Rive yourself, read its inputs, and drive MascotPlayback:
MascotPlayback methods: setTimeline(tl), pushVisemes(cues), play(), pause(), seek(ms), reset(), setTransitionSpeed(n). getRiveInputs(rive) returns a bundle with .has(name); hasRiveInput(rive, name) is the standalone presence check. The SDK only writes mouth / is_speaking / stress — see Rive co-existence.

Next

Streaming sessions

createStreamingSession in depth.

PCM stream player

Play + tap raw provider PCM.

Offline lip sync

Generate → persist → replay.