Godot 4.0 have native TTS implementation for all platforms (Android, iOS, Linux, macOS, Windows and Web), see godotengine/godot#56192 (backport for 3.x - godotengine/godot#61316)
This GDNative module implements minimal native text-to-speech interface for Godot Engine on Windows, macOS and Linux.
- Godot 3.x (3.0.6+)
- GCC or Clang
- Meson build system
- Speech Dispatcher library and development files (libspeechd)
- Godot 3.x (3.0.6+)
- Xcode
- Meson build system
- Godot 3.x (3.0.6+)
- MinGW-W64 or Microsoft Visual C++
- Meson build system
Download release archive and extract it into your project directory.
- Go to the root directory of the source code.
- Run the build system:
meson [build_dir] --buildtype=release
ninja -C [build_dir]
const TTSDriver = preload("res://TTSDriver.gdns")
...
var tts = TTSDriver.new()
void tts.speak(String text, bool interrupt)
, Begins speaking synthesized text.void tts.stop()
, Stops synthesis in progress.bool tts.is_speaking()
, Returnstrue
if the synthesizer is generating speech,false
otherwise.Array tts.get_voices()
, Returns anArray
of voice informationDictionaries
. WhereString name
is voice identifier andString language
is language code inlang_variant
format.lang
part is 2 or 3-letter code based on the ISO-639 standard, in lowercase.variant
part is engine dependent string describing country, region or/and dialect.void tts.set_voice(String name)
, Sets the speech synthesizer’s current voice.int tts.get_volume()
/void tts.set_volume(int volume)
, The speech synthesizer’s volume. The granularity of the volume is engine dependent. Values may be truncated. Ranges from 0 to 100.float tts.get_pitch()
/void tts.set_pitch(float pitch)
, The speech synthesizer’s pitch. The granularity of the pitch is engine dependent. Values may be truncated. Ranges from -10 to 10.int tts.get_rate
/void tts.set_rate(int rate)
, The speech synthesizer’s rendering rate adjustment. The granularity of the rate is engine dependent. Values may be truncated. Ranges from -100 to 100.
- The source code for the libgdtts module is released under unlicense. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.
- Godot and GodotNativeTools are licensed under MIT license. For more information, see https://github.com/godotengine/godot/blob/master/LICENSE.txt.
- Speech Dispatcher C API library is licensed under GNU Lesser General Public License 2.1 or later. For more information, see https://github.com/brailcom/speechd/blob/master/src/api/c/libspeechd.c
- Speech Dispatcher backend is licensed under GNU General Public License. For more information, see (https://github.com/brailcom/speechd/blob/master/COPYING.