SpVoice spVoice = new SpVoice();
spVoice.Voice = spVoice.GetVoices().Item(7);
spVoice.Speak("你好", SpeechVoiceSpeakFlags.SVSFDefault);这段代码可以正常运行,因为我电脑安装了7种语音库,但我怎么根据语音库的名字,比如“Microsoft Sam”,“Microsoft Simplified Chinese”或者“VW Wang”,按照名字选择voice?而不是像上面代码或者网上所说的0或1选择中英文,都是乱抄袭,根本没搞懂那些下标对应的发音者,我也是醉了...
spVoice.Voice = spVoice.GetVoices().Item(7);
spVoice.Speak("你好", SpeechVoiceSpeakFlags.SVSFDefault);这段代码可以正常运行,因为我电脑安装了7种语音库,但我怎么根据语音库的名字,比如“Microsoft Sam”,“Microsoft Simplified Chinese”或者“VW Wang”,按照名字选择voice?而不是像上面代码或者网上所说的0或1选择中英文,都是乱抄袭,根本没搞懂那些下标对应的发音者,我也是醉了...
{
comboBox1.Items.Add(Token.GetDescription(49));
}
{
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(comboBox1.SelectedIndex);
}
{
for (int i = 0; i < spVoice.GetVoices().Count;i++ ) //遍历语音库
{
string desc = spVoice.GetVoices().Item(i).GetDescription(); // 获取名字
if (desc.Equals(name)) //判断
{
spVoice.Voice = spVoice.GetVoices().Item(i); //赋值
}
} }