Voice¶
Turn on enableVoice and your NPC speaks its replies out loud, positioned in 3D space, and players can talk to it by voice instead of typing.
Turn it on¶
On the NPC's SSAINpc, set enableVoice = true and give it a Voice provider handle in voiceProviderOverride (register one in the Provider Manager). Then tune:
| Field | What it does |
|---|---|
voiceName |
The voice to use (overrides the provider's Default Voice). Depends on the vendor: Grok eve/ara/rex/sal/leo; Orpheus tara…; OpenAI alloy/nova…; ElevenLabs/Cartesia a voice id. Blank = the provider's Default Voice. |
voiceSpeed |
Speaking speed, 1.0 = normal. Grok supports 0.7–1.5; other providers may ignore it. |
hearingRange |
Metres the NPC's voice carries (3D falloff) and how close a player must be for the NPC to hear them. |
voiceDelivery |
How audio is delivered (below). |
voiceAudioSource |
Optional — your own AudioSource. If empty, a 3D one is created on the NPC with maxDistance = hearingRange. |
Delivery modes¶
voiceDelivery trades reliability for latency:
| Mode | Behavior | Use when |
|---|---|---|
| Buffered | Synthesize the whole reply, then play it. Most reliable. | Default; any provider. |
| Sentence | Synthesize + play per sentence with look‑ahead. Lower latency. | Snappier conversation, any endpoint. |
| Streamed | Play PCM chunks as they arrive. Lowest latency. | A provider that supports streaming TTS. |
Start with Buffered
Buffered always works. Move to Sentence or Streamed only if you want lower latency and your provider/voice supports it.
Speaking, queueing & interruption¶
When one message makes the NPC say several lines — e.g. a multi‑step action where it talks between steps ("Here goes!" → does the flip → "How was that?") — the lines queue and play in order. You don't have to do anything; the NPC speaks them back‑to‑back.
A new player message interrupts the NPC: the moment a player sends another line, the NPC stops talking immediately (barge‑in) and responds to the new input. This keeps conversation responsive — players never have to wait out a long reply before they can speak again. (Lines from the same message still queue; only a new message interrupts.)
Players talking to the NPC (voice input)¶
With voice enabled, players can speak to the NPC instead of typing: holding the voice key captures speech near an NPC, transcribes it (speech‑to‑text), and sends it to the NPC as a normal message. From the NPC's side it's identical to a typed line — your personality, actions, and world events all behave the same.
Spatial audio¶
NPC speech plays from the NPC's position with 3D falloff out to hearingRange, so players hear it get louder as they approach and it fades with distance — no setup beyond hearingRange (unless you supply your own voiceAudioSource).
Lip-sync (moving the mouth)¶
Point the NPC's voice at its face and the mouth moves in time with the speech — the same lip-sync engine player avatars use, driven straight from the NPC's AI voice. It's fully automatic once configured, needs no extra networking (every nearby player hears the same audio, so everyone sees matching lips), and works with any voice provider or delivery mode.
Requirements: a skinned mesh on the NPC with viseme blendshapes — the mouth shapes for each speech sound (sil, PP, FF, TH, DD, kk, CH, SS, nn, RR, aa, E, I, O, U). Most avatar/character meshes exported for lip-sync already have them (named vrc.v_aa, viseme_PP, and so on).
Set it up¶
On the NPC's NPCController (the component sitting next to SSAINpc):
- Tick Use Viseme Lipsync.
- Click Auto-detect visemes from mesh. It finds the mesh with the most blendshapes and fills in the 15 viseme slots by matching the common naming conventions. The inspector shows
n / 15mapped. - If a slot didn't resolve (an unusual rig), type the blendshape name into that slot yourself — auto-detect never overwrites a name you set.
That's it. When the NPC speaks, its mouth animates; when it's silent, the mouth closes.
Field (NPCController) |
What it does |
|---|---|
useVisemeLipsync |
Turn NPC lip-sync on/off. |
visemeMesh |
The mesh carrying the viseme blendshapes. Leave empty to auto-pick the skinned mesh with the most blendshapes. |
visemeBlendshapes |
The 15 viseme blendshape names, in order. Auto-detected; override any slot for a non-standard rig. |
It just works at runtime too
If you enable lip-sync but never open the auto-detect button, the NPC still resolves its visemes the first time it speaks. Opening the editor just lets you check the mapping and fix any slot beforehand.
Example — a talking shopkeeper¶
- Drop your character model in the scene and add
SSAINpc(this also addsNPCController). Give it a name and personality, and setenableVoice = truewith a Voice provider (Voice setup). - On its
NPCController, tick Use Viseme Lipsync → Auto-detect visemes from mesh. Confirm it reads 15 / 15 mapped (or fix any missing slot). - Press Play and talk to the NPC. It replies out loud and its mouth moves with the words.
If the mapping shows 0 / 15, the mesh has no viseme blendshapes (or they're named unusually) — pick the right visemeMesh, or add/rename the blendshapes on the model.
Tuning¶
Mouth feel (how snappy/held the shapes are) is shared with player lip-sync and lives under Settings ▸ Lip-Sync in-app — the sliders apply live, no rebuild. Lip-sync is computed per-viewer, so a player who turns Avatar Dynamics / lip-sync down for performance simply sees a still mouth; the audio is unaffected.
Notes¶
- Voice uses a Voice‑type provider (Providers & keys) — separate from the text/LLM provider that drives the conversation. An NPC can use one of each.
- Voice key handling is the same as any provider: stored server‑side, never in your world.