https://docs.godotengine.org/en/4.3/tutorials/audio/text_to_speech.html


项目设置,高级设置打开

音频-常规
文本转语音


extends Control
func _on_ready() -> void:
pass # Replace with function body.
func _on_button_pressed() -> void:
# One-time steps.
# Pick a voice. Here, we arbitrarily pick the first English voice.
var voices = DisplayServer.tts_get_voices_for_language("zh")
var voice_id = voices[0]
DisplayServer.tts_speak("中文字体测试", voice_id)
pass # Replace with function body.