How to use all voices available?
Asked Answered
C

1

7

I am using this command to list available voices

private static SpeechSynthesizer sprecher;

...

sprecher = new SpeechSynthesizer();

...

private static List<VoiceInfo> GetInstalledVoices()
{
    var listOfVoiceInfo = from voice
                          in sprecher.GetInstalledVoices()
                          select voice.VoiceInfo;

    return listOfVoiceInfo.ToList<VoiceInfo>();
}

I get only 4 different voices (Hedda, Hazel, David and Zira) yet windows itself shows many more speakers.

enter image description here

Therefore I only get the "-Desktop"-voices. How do I access the other speakers via c#?

Compact answered 2/4, 2018 at 16:25 Comment(3)
I deleted my answer because I couldn't get it to work locally, I tried doing the registry copy mentioned here : social.msdn.microsoft.com/Forums/en-US/…Illness
@hellyale You were spot on. Using this registry copy I solved it. Maybe you need to export it, like I did? Export the whole Token Directory of Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices to a file. Replace every HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens with HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens in the file and run the file(I removed the voices I alread have before). Change CPU to x64. Enjoy.Compact
Ok, I am going to undelete and add those details.Illness
I
4

Edit 2: OP got it to work by using export instead of command line copying

Export the whole Token Directory of Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices to a file. Replace every HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens with HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens in the file and run the file(I removed the voices I already had before).

On the following thread a MSDN user, A.Kelany, asks a similar question, where he is only getting two voices from the GetInstalledVoices method.

He said he was able to fix this by doing the following :

I managed to get it to work in a test project by doing the following : I opened the registry and noticed that there is a node : Quote: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices

which contained the voices that appear in the application GetInstalledVoices method

and there is another node :

Quote: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices

that contained all the voices including the ones don't appear in the aforementioned method,

So I copied one of the voices from the second node to the first node and it worked!

He also states that he could not build on Any CPU after this change, and had to change the build type to x64

Illness answered 2/4, 2018 at 17:20 Comment(2)
Wow6432Node is where 32-bit registry entries are located on 64-bit windows. You need to copy these for it to work correctly on Any CPU. Just follow the same process of exporting the HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Speech_OneCore\Voices entries to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices.Bouldin
Some voices did not show up, but changing to x64 fixed issueIshmael

© 2022 - 2024 — McMap. All rights reserved.