【发布时间】:2019-07-08 00:33:48
【问题描述】:
我刚刚安装了 Microsoft 语音 SDK 11,并为英语和中文添加了 2 种不同的运行时语言。
英文似乎运行良好,虽然中文抛出了这个错误
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);
}
}
}
在另一个问题中我发现了这个answer, 其中指出(自?)Windows 8.1 中缺少关键文件, 但没有说明如何获取这些的任何方法。
我目前使用的是 64 位版本的 windows 10。
编辑:我下载了文件 chsbrkr.dll 和 chtbrkr.dll 并得到以下新错误
An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.Speech.dll
再次在我的代码中使用同一行。
【问题讨论】:
-
您的问题解决了吗?我遇到了同样的问题...谢谢。
-
不,我没有找到解决方案。
-
我在遇到同样的日语问题(Windows 10,Speech v11)后发现了这个问题。我无权访问 DLL 来尝试一下(它们可能仅适用于中文),所以我不知道它是否能解决问题。
标签: c# text-to-speech