Skip to main content
Not every character needs a conversation. LokutorVoice 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 a LokutorVoice node to the character (a Node3D: the head is a good place), 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. Lines can carry expression tags and be up to 5,000 characters. line_started and line_finished carry the text, for subtitles and gestures; error_occurred says what failed. It finds a LokutorLipSync beside it, and can share one with a LokutorAgent.

Lines are kept

Each line is made once and kept in Cache Dir (user://lokutor_voices) with its mouth shapes: said again, it starts at once and costs nothing. 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. Run this once from a tool script or a scene of your own:
Then set Cache Dir to res://voices and add *.lokvoice to the export preset’s Filters to export non-resource files. 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 ticket_provider, as for an agent.

Text to speech

LokutorTTSClient is the request itself:
  • Audio is 16-bit PCM, 44.1 kHz, mono. audio and visemes signals (or the on_audio and on_visemes options) carry it as it is made; the result has all of it.
  • Requests run one after another, and the connection stays open a few seconds (keep_open_seconds) so the next one skips the handshake. While open it counts as a session.
  • cancel() stops everything; with the ticket you gave a request, only that one.
  • Options: voice, language, speed, temperature, dictionary_ids, pronunciations… (Text to speech).
To play it as it arrives use a LokutorVoicePlayer, which also has the clock for lip sync:

Speech to text

LokutorSpeechToTextClient transcribes the microphone as the player talks: voice commands, dictation, captions. There is no language model behind it.
keyterms are the names recognition would not know (Custom vocabulary). end_utterance() finishes what is being said now, for a push-to-talk key. With use_microphone off you send the audio yourself with send_audio(): 16-bit PCM, 16 kHz, mono, silences included. LokutorSTTClient transcribes one whole recording:

A conversation without a character

LokutorVoiceAgentClient is the protocol alone, with the names of the JavaScript SDK (connect and disconnect are open and close, because every Godot object already has the other two). Use it for a narrator, a companion app or a UI of your own:

Your own model

llm points a conversation at an OpenAI-compatible endpoint, and on_llm_request answers it from the game (Bring your own LLM). Both are on LokutorAgent too; set them before the conversation starts (with Start On Ready off).