C#SpeechSynthesizer-“系统上未安装语音” [英] C# SpeechSynthesizer - "No voice installed on the system"

查看:1703
本文介绍了C#SpeechSynthesizer-“系统上未安装语音”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试制作一个简单的控制台程序,该程序使用 System.Speech.Synthesis 中的 SpeechSynthesizer 到语音,但它不起作用。

I have tried to make a simple console program which uses SpeechSynthesizer from System.Speech.Synthesis to convert text to speech but it doesn't work.

我正在使用64位Windows 7和Visual Studio 2010(我认为使用.NET Framework 4.0?)

I am using 64-bit Windows 7 and Visual Studio 2010 (with .NET Framework 4.0 I think?)

程序:

using System.Speech.Synthesis;
// *skip*
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.SetOutputToDefaultAudioDevice();
speech.Speak("Hello world");

InvalidOperationException 出现在<$ c $行c> speech.Speak(...)并显示消息系统上未安装语音或在当前安全设置下不可用。

speech.GetInstalledVoices()显示已安装Microsoft Anna,并且其中的 Enabled 已安装也设置为 true

speech.GetInstalledVoices() shows that there is Microsoft Anna installed and the Enabled of it is also set to true.

我尝试替换 System.Speech.Synthesis Microsoft.Speech.Synthesis (在C:\Program Files(x86)\Microsoft Speech Platform SDK\Assembly\Microsoft找到dll。

I have tried replacing System.Speech.Synthesis with Microsoft.Speech.Synthesis (dll found at C:\Program Files (x86)\Microsoft Speech Platform SDK\Assembly\Microsoft.Speech.dll) but the same thing happens.

导航到控制面板>语音>文本到语音并单击预览语音也会失败,并显示一条消息 This声音无法播放。请尝试选择其他声音或选择其他音频输出设备。在那里找到Microsoft Anna-英语(美国)。

Navigating to Control Panel > Speech > Text To Speech and clicking "Preview Voice" also fails with a message This voice cannot be played. Please try selecting another voice or selecting a different audio output device. Microsoft Anna - English (United States) is found there as the only option.

(Windows '语音识别仍然有效,如果有帮助的话。)

(Windows' Speech Recognition works though, if that has any help.)

某些解决方案建议导航至注册表编辑器,HKEY_LOCAL_MACHINE>软件> Microsoft> Speech> Voices>令牌并修复损坏的语言键。在令牌下是MS-Anna-1033-20-DSK>属性,而语言键应为409。

Some solution suggested navigation to Registry Editor, HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Speech > Voices > Tokens and fixing a broken Language-key. Under token is MS-Anna-1033-20-DSK > Attributes and the Language-key is 409 as it should be.

另一种解决方案建议从Visual更改Active解决方案平台Studio的配置管理器,但是我已经用任何CPU,x86和x64对该程序进行了测试,但均无法正常工作。

Another solution suggested changing Active solution platform from Visual Studio's Configuration Manager but I have tested the program with Any CPU, x86 and x64 and none works.

我的文字转语音有什么问题? :(

What's wrong with my text to speech? :(

编辑:

安装Visual Studio 2012以防万一由于VS2012支持4.5的.NET Framework 4.0出现了问题,但是它也不起作用。

Installed Visual Studio 2012 just in case it was a problem with .NET Framework 4.0 as VS2012 supports 4.5, but it didn't work either.

我想问题出在我的Windows 7中,即使是内置的Text语音转换不起作用。

I suppose the problem is within my Windows 7 as even the built in Text-to-Speech thing doesn't work.

推荐答案

最后解决了。

我的SpeechEngine(或Windows 7上的所有功能)显然已损坏,并且正在运行系统文件检查器(SFC)对其进行了修复。

My SpeechEngine (or whatever the whole thing is called on Windows 7) was apparently corrupted and running System File Checker (SFC) fixed it.

要运行证监会,键入cmd(必须以管理员身份运行)sfc / scannow

To run SFC, type into cmd (must be ran as administrator) sfc /scannow

这篇关于C#SpeechSynthesizer-“系统上未安装语音”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆