语音合成器无法工作并出现错误

发布于 2024-12-23 08:23:13 字数 1138 浏览 0 评论 0原文

运行这个简单的程序时出现异常。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独自←快乐 2024-12-30 08:23:14

尝试使用 System.Speech 而不是 Microsoft.Speech

Try using System.Speech instead of Microsoft.Speech

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文