Godot Android Text to Speech
1.0.0
This is a Android plugin for Godot Engine 3.4 or higher.
This plugin supports:
release tab, choose a version and download the respective package;GodotTTS.gdap and GodotTTS.x.y.z.release.aar inside the res://android/plugins directory on your Godot project.# Init TTS engine with language and country (example -> "en", "US")
setLanguage(String lang, String country)
# Is languange can be used in engine, returns constant
isLanguageAvailable(String lang, String country)
# TTS, play text with specified voice
speak(String text)
# Is TTS busy speaking
isSpeaking()
# Set speech pitch
setPitch(float pitch)
# Set speech rate
setSpeechRate(float speechRate)
# Stop playing voice
stop()start
done
var tts
func _ready():
if Engine.has_singleton("GodotTTS"):
tts = Engine.get_singleton("GodotTTS")
tts.connect("start", self, "_on_tts_start")
tts.connect("done", self, "_on_tts_done")
if tts.isLanguageAvailable("en", "EN"
tts.setLanguage("en", "EN")
func _on_Button_pressed():
var text = "Hello World!"
if tts:
tts.stop()
tts.setPitch(rand_range(0.5, 1.5))
tts.setSpeechRate(rand_range(0.5, 1.5))
tts.speak(text)
func _on_tts_start():
# do stuff when TTS starts speaking
func _on_tts_done():
# do stuff when TTS stops speakingIf you want to compile the plugin by yourself, it's very easy:
godot-text-to-speech directory in Android Studiogodot-lib.release.aar to godot-lib.release directoryIf everything goes fine, you'll find the .aar files at godot-text-to-speech/godot-tts/build/outputs/aar/.
First of all, please make sure you're able to compile the custom build for Android without plugin, this way we can isolate the cause of the issue.
Using logcat for Android is the best way to troubleshoot most issues. You can filter Godot only messages with logcat using the command:
adb logcat -s godot
Google Developers:
MIT license