SAPI 5 voice synthesis and C#

2019-03-30 09:50发布

I have installed new SAPI5 voice. In computer settings of Speech program is new voice visible and available to use. But my program cannot find it. To find it, I am using this part of code, I use System.Speech.Synthesis namespace.

SpeechSynthesizer s = new SpeechSynthesizer();
foreach (InstalledVoice v in s.GetInstalledVoices())
{
    st += v.VoiceInfo.Name+"\n";
}

MessageBox.Show(st);

The only voice found is Microsoft Anna. My code for speeking is as follow:

s.SelectVoice("Eliska22k");//name of the voice is Eliska22k

s.Speak("ahoj");

I am using C# 4 and I have windows vista 32 bit. Where is my mistake? Is in the code or anywhere else?

EDIT: requested registry values:

in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices

DefaultTokenId: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\TokenEnums\Infovox Desktop v2.2\Eliska22k

DefaultTTSRate: 0

in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\TokenEnums\Infovox Desktop v2.2\Eliska22k

405: Eliska (Czech) SAPI5

CLSID: {F8E89351-F6B9-4C98-91F9-A967BA752655}

VoiceData: Eliska22k

in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\TokenEnums\Infovox Desktop v2.2\Eliska22k\Attributes

Age: Adult

AudioFormats 18

Gender: Female

Language: 405;5

Name: Eliska22k

1条回答
你好瞎i
2楼-- · 2019-03-30 10:02

You can try to change the target platform and Framework version of your .NET project. Some voices are supported only for x86.

查看更多
登录 后发表回答