我已经安装了Microsoft Speech Platform SDK和Runtime以及两个英语和俄语语言包。我的代码
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
synthesizer.Volume = 100; // 0...100
synthesizer.TtsVolume = 100;
synthesizer.Rate = 0; // -10...10
foreach (InstalledVoice voice in synthesizer.GetInstalledVoices()) {
VoiceInfo info = voice.VoiceInfo;
Console.WriteLine(" Voice Name: " + info.Name);
synthesizer.SelectVoice(info.Name);
synthesizer.SpeakStarted += SPeackStarted;
synthesizer.Speak("Hello");
Console.ReadKey();
}
但它没有说话。我究竟做错了什么?
答案 0 :(得分:1)
我认为你仍然需要配置音频输出。
你可以这样做: SpeechSynthesizer synthesizer = new SpeechSynthesizer();
synthesizer.SetOutputToDefaultAudioDevice();
了解更多信息:
http://msdn.microsoft.com/en-us/library/system.speech.synthesis.speechsynthesizer%28v=vs.110%29.aspx