中文TTS失败,而英语有效 [英] Chinese TTS Fails, while English works
问题描述
我刚刚安装了Microsoft Speech SDK 11,并为英语和中文添加了2种不同的运行时语言.
I just installed the Microsoft speech SDK 11 and added 2 different Runtime languages for english and chinese.
英语似乎运行得很好,尽管中文抛出了这个错误
English seems to run fine, though chinese throws me this error
System.InvalidOperationException
附加信息
Speak error '80004005'
该行
synth.Speak(s);
在以下代码中
using System;
using Microsoft.Speech.Synthesis;
namespace SampleSynthesis
{
class Program
{
static void Main(string[] args)
{
speakString(0, "Hello, I'm TTS.");
}
static void speakString(int i, String s)
{
// Initialize a new instance of the SpeechSynthesizer.
SpeechSynthesizer synth = new SpeechSynthesizer();
// Select a voice.
switch (i)
{
case 0:
synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-US, ZiraPro)");
break;
case 1:
synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (zh-CN, HuiHui)");
break;
}
// Configure the audio output.
synth.SetOutputToWaveFile(@"C:\Users\David\Desktop\TTStest\test.wav");
synth.Speak(s);
}
}
}
在另一个问题中,我找到了这个答案,哪个指出(因为?)Windows 8.1中缺少重要文件,但没有说明获取这些内容的任何方法.
In another question I found this answer, which states that there are crucial files missing in (since?) windows 8.1, but doesn't state any method for how to acquire these.
我当前正在使用Windows 10的64位版本.
I am currently using a 64bit version of windows 10.
我下载了文件chsbrkr.dll和chtbrkr.dll并收到以下新错误
I downloaded the files chsbrkr.dll and chtbrkr.dll and get the following new error
An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.Speech.dll
再次针对我的代码中的同一行.
again for the same line in my code.
推荐答案
由tofutim发布: https://stackoverflow.com/a/28042294/1212314
As posted by tofutim: https://stackoverflow.com/a/28042294/1212314
在Windows 8.1和Windows 8.0之间,删除了两个对于使用服务器语音API至关重要的文件.这些是chsbrkr.dll和chtbrkr.dll,它们将位于Windows 8.0的Windows目录中.从Windows中选择x86 vs x64版本也很重要,具体取决于您的SDK和Windows 8.0版本(x86 vs x64).例如,在64位Windows 8.1环境中,使用32位dll,应将两个文件放在
Between Windows 8.1 and Windows 8.0, two files were dropped that are critical for using the Server Speech API. These are chsbrkr.dll and chtbrkr.dll which will be in the Windows directory in Windows 8.0. It is also important to choose the x86 vs x64 versions from Windows depending on your SDK and Windows 8.0 version (x86 vs x64). For example, in a 64-bit Windows 8.1 environment, using 32-bit dll's, you should place the two files in
C:\ Program Files(x86)\ Common Files \ Microsoft Shared \ Speech \ TTS \ v11.0
C:\Program Files (x86)\Common Files\Microsoft Shared\Speech\TTS\v11.0
希望,微软将修复这些问题(尽管我被告知他们不会这样做)或正式允许分发(祝您好运...).
Hopefully, Microsoft will fix these (though I am told they will not) or officially allow for distribution (good luck...).
顺便说一句,通过Windows 8.0在Windows XP中您不会看到此错误.
BTW, you should not see this error in Windows XP through Windows 8.0.
更新.我相信这些文件被用来将中文分成大块供TTS处理.没有它们,中文TTS将失败并显示错误.
Update. I believe these files are used to break up Chinese into chunks for the TTS to handle. Without them, the Chinese TTS will fail with the error posted.
这篇关于中文TTS失败,而英语有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!