win7TTS修复,使用C#SpeechSynthesizer 类

win7TTS修复,使用C#SpeechSynthesizer 类



问题背景

  • 环境
    win7(貌似是阉割版,朗读女安装之后只有联网才有声音)
  • 代码
    C#下的SpeechSynthesizer类
// 参考网址
// https://msdn.microsoft.com/zh-cn/library/system.speech.synthesis.speechsynthesizer.aspx
// 记得引用System.Speech,这是一个用于演示的控制台程序
using System;
using System.Speech.Synthesis;

namespace SampleSynthesis
{
  class Program
  {  
    static void Main(string[] args)
    {

      // Initialize a new instance of the SpeechSynthesizer.
      SpeechSynthesizer synth = new SpeechSynthesizer();

      // Configure the audio output. 
      synth.SetOutputToDefaultAudioDevice();

      // Speak a string.
      synth.Speak("This example demonstrates a basic use of Speech Synthesizer");

      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
  }
}
  • VS目标平台最好修改为 X86

解决方案

1. 先去下载Speech SDK 5.1

默认的安装路径是 C:\Windows\System32\Speech
下载链接
下载演示
下载完成后尝试一下,我是直接失败报错
报错异常

2. 超复杂解决方案

在此感谢静远的博客
其他参考资料:
参考一
参考二

  1. TTSrepair.exe,该安装程序安装时会在安装程序所在文件夹生成两个文件,手动删除即可;
  2. 根据不同的操作系统版本下载“SpeechPlatformRuntime(x64).msi”或“SpeechPlatformRuntime(x86).msi”安装;
  3. MSSpeech_TTS_zh-CN_HuiHui.msi
  4. voice.reg 覆盖注册表,该操作实际上就是使用上面第二篇博文中的“修改注册表”方法;

再次拜谢,推荐大家去看原博主的博客上面附上的文件下载地址

猜你喜欢

转载自blog.csdn.net/Simoral/article/details/80616586