Text to Speech 1.0.0 · changelog

Text to Speech changelog

All notable changes to this package are documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.0.0] - 2026-10-21

Added

  • TextToSpeech (namespace Luanrobs.Speech): a static API over the speech engine of the platform. Initialization is asynchronous and starts on the first request: State, IsReady, Initialized, InitializationFailed, a timeout (DefaultTimeout, 10 s) and a clear error when the device has no engine.
  • Voices: Voices, GetVoices(offlineOnly), GetVoices(language, offlineOnly), DefaultVoice and ResolveVoice. A SpeechVoice has an id, a name, a BCP-47 language, a gender where the platform reports one, and installed and network flags. Offline voices only by default; choice by id or by language with a fixed fallback order.
  • Speak: the platform plays the text. A queue with SpeechQueueMode.Enqueue and Interrupt; Stop, StopAll and SpeechUtterance.Cancel; IsSpeaking and IsBusy.
  • Synthesize: renders the text to an AudioClip from the engine's audio, with word boundaries. When the engine reports none, the boundaries are estimated and marked IsEstimated.
  • SpeechOptions: voiceId, language, rate (0.5 to 3), pitch (0.5 to 2), volume (0 to 1), queueMode, ssml and offlineOnly. The volume of a synthesized clip is applied by the package, linearly, so it is the same on both platforms.
  • Events Started, WordBoundary, Error and Finished on TextToSpeech and on each SpeechUtterance, raised on the main thread. Exactly one Finished per request. SpeechUtterance can be waited on with yield return, and WordIndexAt(seconds) finds the word heard at a time.
  • Errors do not throw: they arrive as a SpeechError with a SpeechErrorCode (NotSupported, NoEngine, InitializationTimeout, InitializationFailed, VoiceNotFound, LanguageNotAvailable, VoiceNotInstalled, SsmlNotSupported, NetworkError, OutputError, InvalidAudio, EngineError). Wrong arguments throw, and calls from another thread throw InvalidOperationException.
  • SpeechClipCache: renders a text once per voice and options, returns the stored clip and its word timings afterwards, and drops the least recently used clip beyond its capacity.
  • SpeechSource component (Add Component > luanrobs > Speech Source, GameObject > Audio > Speech Source (luanrobs)): speaks a text or a Text Asset, in Speak output or in AudioSource output (a synthesized clip played on an AudioSource, so 3D sound, mixer groups and effects apply). UnityEvents OnStarted, OnWord, OnFinished, OnError, and C# events.
  • SubtitleHighlighter component (needs uGUI): shows the text being spoken in a legacy Text (default) or a TextMeshPro text and colours the word being heard. SpeechRichText escapes and highlights text for rich-text labels.
  • Inspector preview of a SpeechSource in the Windows Editor (Preview and Stop), with a voice pop-up, a Refresh voices button and a status line. Tools > luanrobs > Text to Speech > Documentation opens the manual on click.
  • Windows (64-bit player and Editor): Windows.Media.SpeechSynthesis through a small native DLL (LuanrobsSpeech.dll) shipped with its C++ source and build script in Native~/Windows. Word timings come from the engine. SSML is passed through unchanged.
  • Android: the device's TextToSpeech engine through Java source (LuanrobsSpeech.androidlib) that Unity compiles with Gradle, with no .aar, no .so and no permission. Word timings from onRangeStart on API 26 and newer when the engine reports them. Initialize(timeout, engine) can choose an installed engine, and OpenInstallVoiceData() opens the engine's voice data screen when you call it. When the engine's process ends while the app runs, the requests in flight fail with EngineError and the package connects to the engine again; requests made meanwhile go to it.
  • Windows: initialization does not block the main thread (the voice list is read on a thread of the DLL), and Speak and Synthesize render on separate threads, so a Speak does not wait for a long Synthesize.
  • Other platforms compile and report SpeechErrorCode.NotSupported.
  • Designed for Domain Reload disabled: static state is reset when Play mode starts, and the Edit-mode preview is dropped when Play mode starts and ends.
  • Demo sample with five scenes: menu, voice playground, narrated menu, talking character and subtitles.
  • Manual with quick start, voice selection, events, the clip cache, platform notes, limits and troubleshooting.
  • EditMode and PlayMode tests.

Tested

  • Unity 6000.3.12f1 on Windows 11, 2026-10-21: 281 of 281 EditMode tests and 21 of 21 PlayMode tests passed in the development project and in a clean project with the package installed from a .tgz archive; a Domain Reload check (three Play sessions with Domain Reload disabled) passed.
  • Unity 6000.0.84f1 on Windows 11, 2026-10-21, in a clean project with the package installed from the archive: 281 of 281 EditMode tests and 21 of 21 PlayMode tests passed.
  • An earlier build of this version in a clean project without com.unity.ugui, Unity 6000.3.12f1, 2026-10-21: every package assembly compiled and the EditMode tests of that build (261) passed.
  • Windows players, 2026-10-21: a smoke driver walked the five demo scenes and synthesized with the two installed voices (Microsoft Maria and Microsoft Daniel, both pt-BR) and passed: Mono and IL2CPP from the development project (6000.3.12f1), and Mono from the clean projects on 6000.3.12f1 and 6000.0.84f1. The audio was measured (length, level, pitch, and the energy after each word boundary), not listened to.
  • Android x86_64 emulators, 2026-10-21, IL2CPP builds from the clean projects: API 26 with Google APIs (6000.0.84f1 build) and API 36 with Google Play (6000.3.12f1 build), both with Google's engine (com.google.android.tts). The smoke driver passed on both. Synthesize clips had estimated word timings on both; Speak raised word events on API 36 and none with the first voice tried on API 26. Stopping the engine's process during a Speak ended it with EngineError within 2.2 s, and the next Synthesize completed.
  • Not run: Android API 23 to 25, ARM64 Android, a physical Android device, Android engines other than the emulator's, Windows 10, voices in a language other than pt-BR, macOS, Linux, iOS, WebGL and the other platforms.

Known limitations

  • Windows (64-bit) and Android only. iOS, macOS, Linux, WebGL, 32-bit Windows and ARM64 Windows report NotSupported.
  • Offline voices only: no cloud or neural voices, and no voice is bundled or downloaded. A language may be missing on a device.
  • SSML on Windows only. A text holds at most 3999 UTF-16 units, and the whole text is rendered before it plays.
  • Speak plays through the operating system, so Unity's audio settings do not apply to it. Speech cannot be paused and resumed. No streaming synthesis, speech recognition or lip-sync.
  • Tested on Windows 11 only; the Android library is built for minSdk 23 (Unity 6000.3 raises its own minimum to 25), and it ran only on API 26 and API 36 emulators.