Vitalis Hommel
Vitalis Hommel

Reputation: 1040

How to use all voices available?

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#?

Upvotes: 7

Views: 2523

Answers (1)

M Y
M Y

Reputation: 1832

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

Upvotes: 4

Related Questions