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開發人員:
麻省理工學院許可證