中文 TTS 抛出 SAPI ERROR E_FAIL

Sur*_*123 3 sapi text-to-speech

这是我的中文 TTS 代码,尽管中文 TTS 引擎安装成功,但说话功能失败

\n\n
using Microsoft.Speech.Synthesis;\nusing System.Globalization;\n\nnamespace TTS3\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n                //CultureInfo=new CultureInfo("zh-CN");\n            SpeechSynthesizer synth = new SpeechSynthesizer();\n\n// Output information about all of the installed voices. \n            foreach (InstalledVoice voice in synth.GetInstalledVoices(new CultureInfo("zh-CN")))\n                {\n                    synth.SelectVoice(voice.VoiceInfo.Name);\n                    //Console.WriteLine(synth.Voice.Description);\n                    synth.SetOutputToWaveFile("C:\\\\Users\\\\surabhi\\\\Desktop\\\\yes.wav");\n                    synth.Speak("\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xb8\x96\xe7\x95\x8c");\n                    break;\n}\n            Console.WriteLine();\n            Console.WriteLine("Press any key to exit...");\n            Console.ReadKey();\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

代码抛出的异常是

\n\n
Unhandled Exception: System.InvalidOperationException: Speak error \'80004005\'. -\n--> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been r\neturned from a call to a COM component.\n   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 e\nrrorCode, IntPtr errorInfo)\n   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode\n)\n   at Microsoft.Speech.Internal.Helpers.ExceptionFromSapiError(SAPIErrorCodes er\nrorCode)\n   --- End of inner exception stack trace ---\n   at Microsoft.Speech.Synthesis.SpeechSynthesizer.SpeakPrompt(Prompt prompt, Bo\nolean async)\n   at Microsoft.Speech.Synthesis.SpeechSynthesizer.Speak(Prompt prompt)\n   at Microsoft.Speech.Synthesis.SpeechSynthesizer.Speak(String textToSpeak)\n   at TTS3.Program.Main(String[] args) in c:\\Users\\surabhi\\Documents\\Visual Stud\nio 2013\\Projects\\TTS3\\TTS3\\Program.cs:line 23\n
Run Code Online (Sandbox Code Playgroud)\n\n

请帮我解决这个问题

\n

tof*_*tim 5

在 Windows 8.1 和 Windows 8.0 之间,删除了两个对于使用服务器语音 API 至关重要的文件。它们是 chsbrkr.dll 和 chtbrkr.dll,它们位于 Windows 8.0 的 Windows 目录中。根据您的 SDK 和 Windows 8.0 版本(x86 与 x64)从 Windows 选择 x86 与 x64 版本也很重要。例如,在 64 位 Windows 8.1 环境中,使用 32 位 dll,您应该将这两个文件放在

C:\Program Files (x86)\Common Files\Microsoft Shared\Speech\TTS\v11.0

希望微软能够修复这些问题(尽管我被告知他们不会)或正式允许分发(祝你好运......)。

顺便说一句,您不应该在 Windows XP 到 Windows 8.0 中看到此错误。

更新。我相信这些文件用于将中文分解成块以供 TTS 处理。如果没有它们,中文 TTS 将失败并显示错误。