Godot Android Text to Speech
1.0.0
这是Godot Engine 3.4或更高的Android插件。
此插件支持:
release tab ,选择一个版本并下载相应的软件包;GodotTTS.gdap和GodotTTS.xyzrelease.aar放在res://android/plugins目录内的godot项目。 # 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 speaking 如果您想自己编译插件,这很容易:
Android Studio中开放godot-text-to-speech目录godot-lib.release.aar放在godot-lib.release目录如果一切顺利,您会在godot-text-to-speech/godot-tts/build/outputs/aar/找到.aar文件。
首先,请确保您能够在没有插件的情况下为Android编译自定义构建,这样我们就可以隔离问题的原因。
将logcat用于Android是解决大多数问题的最佳方法。您可以使用命令使用logcat过滤Godot消息:
adb logcat -s godot
Google开发人员:
麻省理工学院许可证