【问题标题】:Speech synthesizer can't select installed voice语音合成器无法选择已安装的语音
【发布时间】:2015-11-23 09:27:01
【问题描述】:

我有以下程序:

        SpeechSynthesizer synth = new SpeechSynthesizer();
        List<InstalledVoice> installedVoices = new List<InstalledVoice>();
        foreach (InstalledVoice voice in synth.GetInstalledVoices())
        {
            installedVoices.Add(voice);
            Console.WriteLine(voice.VoiceInfo.Name);
        }
        synth.SelectVoice(installedVoices[1].VoiceInfo.Name);
        synth.Speak("This is in English");

安装声音的输出是这样的:

Microsoft Anna
Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)
Microsoft Server Speech Text to Speech Voice (fr-CA, Harmonie)
Microsoft Server Speech Text to Speech Voice (nl-NL, Hanna)

当我使用synth.SelectVoice(installedVoices[0].VoiceInfo.Name); 运行程序时 它可以正常工作。 当使用synth.SelectVoice(installedVoices[1].VoiceInfo.Name); 运行它时 为了让 Hazel 阅读这句话,我得到以下SystemArgumentException

{"Cannot set voice. No matching voice is installed or the voice was disabled."}

并且所有声音都已启用。 我已经安装了以下东西:

  1. Microsoft 语音平台 - 运行时(版本 11)
  2. Microsoft 语音平台 - 软件开发工具包 (SDK)(版本 11)
  3. 以及打印列表中显示的其他语言。

然后我按照this 指南让我的语言被我的操作系统 (win7x64) 识别。 我怎么只能用安娜?

【问题讨论】:

    标签: c# text-to-speech


    【解决方案1】:

    我成功了。这就是我所做的。 我用错了SpeechSynthesizer 我用错了System.Speech.SpeechSynthesizer 而不是Microsoft.Speech.Synthesis。您必须添加位于C:\Program Files\Microsoft SDKs\Speech\v11.0\AssemblySpeech.dll 参考

    然后我可以使用 Hazel、Harmonie 和 Hanna,但不再使用 Anna(反正我不需要她)。

    另外不要忘记将您的项目构建设置为 x64,因为 SDK 是 x64 或安装 x86 SDK 和运行时。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-14
      • 1970-01-01
      相关资源
      最近更新 更多