Skip to main content
Not every character needs a conversation. Lokutor Voice says lines you wrote, with the same voices and lip sync, and the clients underneath give you text to speech and speech to text on their own.

Written lines

Add Component > Lokutor > Lokutor Voice, pick its Voice and Language, and:
Say returns true when the line has been heard, false if it could not be said or was stopped. SayLine(text) is the same for a UnityEvent. Lines can carry expression tags and be up to 5,000 characters. onLineStarted and onLineFinished carry the text, for subtitles and gestures; Error says what failed. It uses the character’s Lokutor Lip Sync, and can share it with an agent.

Lines are kept

Each line is made once and kept on disk (persistentDataPath/lokutor_voices) with its mouth shapes: said again, it starts at once and costs nothing. Keep Lines turns that off. Fetch the ones you know are coming:

Ship them with the game

Lines recorded into the project need no network, no key and no money while people play. Once, in the editor:
Shipped Lines (LokutorVoices) is the folder, inside a Resources folder, where the component looks for them. A line that changes voice, language or a single word is another line: record it again.

Shipping the key

A game that makes lines while it runs needs a credential. Set TicketProvider, as for an agent.

Text to speech

TTSClient is the request itself, in plain C#:
  • Audio is 16-bit PCM, 44.1 kHz, mono. OnAudio and OnVisemes carry it as it is made, on the thread that called; the result has all of it.
  • Requests run one after another, and the connection stays open a few seconds (KeepOpen) so the next one skips the handshake. While open it counts as a session.
  • Cancel() stops everything; a CancellationToken given to SynthesizeAsync, only that one.
  • Options: Voice, Language, Speed, Temperature, DictionaryIds, Pronunciations… (Text to speech).

Speech to text

SpeechToTextClient transcribes the microphone as the player talks: voice commands, dictation, captions. There is no language model behind it. LokutorAudioManager (a component) is the microphone, and raises its events on the main thread:
Keyterms are the names recognition would not know (Custom vocabulary). EndUtterance() finishes what is being said now, for a push-to-talk key. With ConnectAsync() alone you send the audio yourself with SendAudio (16-bit PCM, 16 kHz, mono, silences included) and call Update() every frame. STTClient transcribes one whole recording:

A conversation without a character

VoiceAgentClient is the protocol alone, with the names of the JavaScript SDK. Use it for a narrator, a companion app or a UI of your own:
Outside Unity, write an IAudioManager and call the client’s Update() every frame. LokutorSession is the layer between the two: a character’s conversation (states, actions, echo guard, the clock for lip sync) without the engine.

Your own model

Llm points a conversation at an OpenAI-compatible endpoint, and OnLlmRequest answers it from the game (Bring your own LLM). Both are on the Lokutor Agent too; set them before the conversation starts (Awake, or with Start On Awake off).