I managed to fix this issue by modifying the Windows registry. In my case, under Windows 10, I installed the German language with TTS package and it installed a female voice (WinRT and SAPI) plus a male voice (WinRT only). I needed to make a desktop (not universal app) program in C# that utilized the male voice but it was not available through SAPI. So I did this "hack" and surprisingly worked right away (Windows 10 version 1803). Works for 32 and 64 bit programs (natively or WOW).
In Windows 8+ there are two speech synthesis programming interfaces (like explained by Eric Brown). But after studying the Windows registry and a couple of files referenced in there, I noticed that both APIs use the same data files so I copied the registry keys from the German male voice registered in WinRT API into the corresponding SAPI section.
Here are the detailed instructions:
- Open "regedit.exe".
- Navigate to the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens
There you will find each WinRT voice registered under its own key. The German male voice in my case is called MSTTS_V110_deDE_StefanM.
The easiest thing is to right click the voice key (MSTTS_V110_deDE_StefanM) and from the context menu select Export to save the entire voice structure to a file (this will later allow you to easily replicate all these steps into a couple of clicks if you want to do this in another computer).
Open the exported file with Notepad or similar. There you will find two key paths. Both will make a reference to the key Speech_OneCore. All you have to do is change both references from Speech_OneCore to Speech.
Remove the entire line for the attributed called SayAsSupport, it is not needed by SAPI.
Save your file. With the modifications it should look like this (take special notice to the key paths):
.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\MSTTS_V110_deDE_StefanM]
@="Microsoft Stefan - German (Germany)"
"407"="Microsoft Stefan - German (Germany)"
"CLSID"="{179F3D56-1B0B-42B2-A962-59B7EF59FE1B}"
"LangDataPath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,53,\
00,70,00,65,00,65,00,63,00,68,00,5f,00,4f,00,6e,00,65,00,43,00,6f,00,72,00,\
65,00,5c,00,45,00,6e,00,67,00,69,00,6e,00,65,00,73,00,5c,00,54,00,54,00,53,\
00,5c,00,64,00,65,00,2d,00,44,00,45,00,5c,00,4d,00,53,00,54,00,54,00,53,00,\
4c,00,6f,00,63,00,64,00,65,00,44,00,45,00,2e,00,64,00,61,00,74,00,00,00
"VoicePath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,53,00,\
70,00,65,00,65,00,63,00,68,00,5f,00,4f,00,6e,00,65,00,43,00,6f,00,72,00,65,\
00,5c,00,45,00,6e,00,67,00,69,00,6e,00,65,00,73,00,5c,00,54,00,54,00,53,00,\
5c,00,64,00,65,00,2d,00,44,00,45,00,5c,00,4d,00,31,00,30,00,33,00,31,00,53,\
00,74,00,65,00,66,00,61,00,6e,00,00,00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\MSTTS_V110_deDE_StefanM\Attributes]
"Age"="Adult"
"DataVersion"="11.0.2013.1022"
"Gender"="Male"
"Language"="407"
"Name"="Microsoft Stefan"
"SharedPronunciation"=""
"Vendor"="Microsoft"
"Version"="11.0"
- Embed the registry keys you created by double clicking the file.
Done! but please note that this will make the voice available through SAPI to 32 bit programs under a 32 bit version of Windows 10, OR, to 64 bit programs under a 64 bit version of Windows 10. If you want to access the voice from a 32 bit program under a 64 bit version of Windows 10 then you need to embed the corresponding keys under the WOW6432Node. To do this, simply make an extra copy of your already edited file and name it something like "my_voice_WOW.reg". Edit this new copy and now in both key paths insert another key named "WOW6432Node" between the keys SOFTWARE and Microsoft. Save your file and embed it, this should create the corresponding keys in the WOW tree-node. Your WOW file should look like this (take special notice to the key paths):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Speech\Voices\Tokens\MSTTS_V110_deDE_StefanM]
@="Microsoft Stefan - German (Germany)"
"407"="Microsoft Stefan - German (Germany)"
"CLSID"="{179F3D56-1B0B-42B2-A962-59B7EF59FE1B}"
"LangDataPath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,53,\
00,70,00,65,00,65,00,63,00,68,00,5f,00,4f,00,6e,00,65,00,43,00,6f,00,72,00,\
65,00,5c,00,45,00,6e,00,67,00,69,00,6e,00,65,00,73,00,5c,00,54,00,54,00,53,\
00,5c,00,64,00,65,00,2d,00,44,00,45,00,5c,00,4d,00,53,00,54,00,54,00,53,00,\
4c,00,6f,00,63,00,64,00,65,00,44,00,45,00,2e,00,64,00,61,00,74,00,00,00
"VoicePath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,53,00,\
70,00,65,00,65,00,63,00,68,00,5f,00,4f,00,6e,00,65,00,43,00,6f,00,72,00,65,\
00,5c,00,45,00,6e,00,67,00,69,00,6e,00,65,00,73,00,5c,00,54,00,54,00,53,00,\
5c,00,64,00,65,00,2d,00,44,00,45,00,5c,00,4d,00,31,00,30,00,33,00,31,00,53,\
00,74,00,65,00,66,00,61,00,6e,00,00,00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Speech\Voices\Tokens\MSTTS_V110_deDE_StefanM\Attributes]
"Age"="Adult"
"DataVersion"="11.0.2013.1022"
"Gender"="Male"
"Language"="407"
"Name"="Microsoft Stefan"
"SharedPronunciation"=""
"Vendor"="Microsoft"
"Version"="11.0"
Hope this helps.