godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.31k stars 21.06k forks source link

DisplayServer tts_get_voices() does not load all installed voices on Windows #69788

Open Xyotic opened 1 year ago

Xyotic commented 1 year ago

Godot version

4.0 beta 7

System information

Windows 10

Issue description

The current implementation of tts_get_voices seems to only load voices that are referenced inside the registry under

"Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens"

But many of windows voices are located under:

"Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens"

Providing the path to these voices to tts_speak however, doesnt seem to work at the moment...

Steps to reproduce

Call tts_get_voices() and compare it to your installed voices and registry

Minimal reproduction project

TTS_Bug.zip

bruvzg commented 1 year ago

tts_get_voices is not reading registry directly, it's listing voices returned by Windows Speech API 5.4.

There are other voices that aren't registered in SAPI and won't work, this is not a bug, but a restriction imposed by Microsoft (probably for licensing reasons), see https://www.ghacks.net/2018/08/11/unlock-all-windows-10-tts-voices-system-wide-to-get-more-of-them/ for example.

Xyotic commented 1 year ago

Would it be possible to use some open source tts library instead?

The current implementation seems a bit limited then, and it would sound different per platform...

Just throwing ideas out.

Calinou commented 1 year ago

Would it be possible to use some open source tts library instead?

We can't bundle TTS soundfonts as we need to keep the binary size low. Also, last time I checked, open source TTS solutions are notorious for being behind proprietary OS-level solutions in terms of output quality.

We can document how to unlock the full range of TTS voices in the meantime, in a way that you can link to your project's users if they wish.

lesleyrs commented 1 year ago

tts_get_voices is not reading registry directly, it's listing voices returned by Windows Speech API 5.4.

There are other voices that aren't registered in SAPI and won't work, this is not a bug, but a restriction imposed by Microsoft (probably for licensing reasons), see https://www.ghacks.net/2018/08/11/unlock-all-windows-10-tts-voices-system-wide-to-get-more-of-them/ for example.

Ok this makes sense. I noticed something weird where exporting to web loads the default system voice on Windows 10 (even without visibly showing it) which desktop doesn't have access to.

Not that it matters as tts keeps cutting off on web and generally doesn't work, but just pointing it out.

lesleyrs commented 1 year ago

@bruvzg I just tried https://github.com/ndarilek/tts-rs which uses WinRT and that does not have the voice limitation on windows. Any voices I add in settings is able to load.

While on Godot only some English voices appear, this would fix the issue.

bruvzg commented 1 year ago

I have done some testing, and it is possible to use WinRT API from C++ app like Godot, but there are a few issues with it:

Leroy-X commented 1 year ago

Hi, @lesleyrs I have test tts tui, it's so ease to used, but how to use the natural voice in Win11 Narrator. The quality of natural voice is higher, look forward to adding natural voice.