语音合成器无法工作并出现错误
运行这个简单的程序时出现异常。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Speech.Synthesis;
namespace speechSynth1
{
class Program
{
static void Main(string[] args)
{
SpeechSynthesizer s = new SpeechSynthesizer();
s.Speak("Hello how are you");
}
}
}
这是例外情况。
Unhandled Exception : System.PlatformNotSupportedExecption : No voice installed on
the system or none available with the current security setting.
at Microsoft.Speech.Internal.Sythesis.VoiceSythesis..ctor<WeakReference speechSynthesizer>
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.get_VoiceSynthesizer()
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.Speak(Prompt prompt)
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.Speak(String textToSpeak)
at speechSynth1.Program.Main(String[] args) in c:\users\project\documents\visual studio 2010\Projects\speechSynth1\speechSynth1\Program.cs : line 14
我不明白出了什么问题。我刚刚检查了控制面板,语音安装正确。
I get an exception running this simple program.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Speech.Synthesis;
namespace speechSynth1
{
class Program
{
static void Main(string[] args)
{
SpeechSynthesizer s = new SpeechSynthesizer();
s.Speak("Hello how are you");
}
}
}
Here is the exceptions.
Unhandled Exception : System.PlatformNotSupportedExecption : No voice installed on
the system or none available with the current security setting.
at Microsoft.Speech.Internal.Sythesis.VoiceSythesis..ctor<WeakReference speechSynthesizer>
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.get_VoiceSynthesizer()
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.Speak(Prompt prompt)
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.Speak(String textToSpeak)
at speechSynth1.Program.Main(String[] args) in c:\users\project\documents\visual studio 2010\Projects\speechSynth1\speechSynth1\Program.cs : line 14
I don't understand what is wrong. I have just checked the control panel and the voice is correctly installed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 System.Speech 而不是 Microsoft.Speech
Try using System.Speech instead of Microsoft.Speech