Skip to main content

Custom voice Integration

In version 2.1.5 and higher, integrating custom voices has become much easier.

In this tutorial, we will guide you through the process of integrating your own text-to-speech (TTS) device.

Disabling Audio Receiving

Starting from version 2.1.6, you can turn off audio by unchecking the Can Receive Audio option in Default Settings.

See the screenshot below for more details.


For users on version 2.1.5 or lower, update InworldSettings.cs by simply setting the Audio of Capabilities to false.


After applying this setting, the server will no longer send audio.

(Optional) Enable Log of Utterance

You can toggle the Log of Utterance option under the InworldCharacter script of the attached character.


You can check the Start() function in InworldCharacter.cs to see how we registered these events.

void Start()
InworldController.Instance.OnCharacterChanged += OnCharacterChanged;
OnBeginSpeaking?.AddListener(() =>
if (m_logUtterances)
InworldAI.Log($"{CharacterName} Started talking");
OnFinishedSpeaking?.AddListener(() =>
if (m_logUtterances)
InworldAI.Log($"{CharacterName} Finshed talking");
OnCharacterSpeaks?.AddListener((character, text) =>
if (m_logUtterances && !string.IsNullOrEmpty(text))
InworldAI.Log($"{character}: {text}");

⚠️ Note: InworldAI.Log is the same as Debug.Log, but logs made using this method will not be included in the release build and can be disabled in Default Settings


Register your own TTS Service

Here's an example of how to use this repo: UnityRuntimeTextToSpeech's API:

public class TestSpeech : MonoBehaviour
public string sayAtStart = "Welcome!";

// Start is called before the first frame update
void Start()
// TEST speech
Speech.instance.Say(sayAtStart, TTSCallback);


According the API above, you need to create a public function like the following.

    public void OnTTSVoice(string character, string content)
if (character != "Player")
Speech.instance.Say(content, TTSCallback); // Referring to your own API

⚠️ Note: In the OnCharacterSpeaks UnityEvent, the first parameter is the name of the speaking character, and the second parameter is the actual content.

Then, add this function to InworldCharacter's OnCharacterSpeaks


Congratulations! You have successfully integrated TTS into your project.

⚠️ Note: Some TTS services (like the example provided) may override the current playing audioclip. We recommend saving the incoming texts in a queue and gradually playing them once the last audio has finished.