首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Microsoft.Speech开发工具包抛出FileNotFoundException?

问使用Microsoft.Speech开发工具包抛出FileNotFoundException?
EN

Stack Overflow用户
提问于 2012-06-18 20:52:34
回答 3查看 6.7K关注 0票数 4

我正在使用Microsoft.Speech SDK (11.0)将文本转换为语音。我有一个windows窗体应用程序,我正在使用一个非常基本的代码来说出输入的文本,但它失败了。以下是我单击该按钮的代码:

代码语言:javascript
复制
SpeechSynthesizer syn = new SpeechSynthesizer();
PromptBuilder pb = new PromptBuilder();
pb.AppendText("Welcome, everyone");
syn.Speak(pb);

上述代码的最后一行出现错误:

代码语言:javascript
复制
FileNotFoundException was unhandled
Exception from HRESULT: 0x8004503A

下面是完整的堆栈跟踪:

代码语言:javascript
复制
at Microsoft.Speech.Synthesis.SpeechSynthesizer.SpeakPrompt(Prompt prompt, Boolean async)
at Microsoft.Speech.Synthesis.SpeechSynthesizer.Speak(Prompt prompt)
at Microsoft.Speech.Synthesis.SpeechSynthesizer.Speak(PromptBuilder promptBuilder)
at MSSpeechSynth.Form1.btnSpeak_Click(Object sender, EventArgs e) in      C:\Users\prashant.k\Desktop\MSSpeechSynth\MSSpeechSynth\Form1.cs:line 30
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MSSpeechSynth.Program.Main() in C:\Users\prashant.k\Desktop\MSSpeechSynth\MSSpeechSynth\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

是什么导致了这个错误?

谢谢

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-06-18 22:54:01

我使用的是sdk 5.1,所以我不是专家...但我会尽力帮你的。

  1. 请确保您的ms speech sdk安装无误https://forums.asp.net/p/1105408/2028838.aspx#2028838

开始>控制面板>易于访问>语音识别,然后单击Text To Speech。

  • 现在使用完整的UAC启动您的应用程序。

  • 尝试使用"try-catch“块。

  • 也请查看此处;我的搜索在此处结束

(对于1> http://msdn.microsoft.com/en-us/library/hh362873.aspx )(对于2>测试“语音引擎”,我们确定sdk没有失败,您的应用程序有一个bug )(对于3>,使用管理权限运行应用程序。)

最后,也是解决这个问题的重要方法;尝试卸载sdk,清理注册表-temp等,然后重新安装sdk。并尝试添加必要的动态链接库从sdk到您的应用程序与nuget打包系统(如果您不能找到ms speech sdk,您可以使用另一个找到类似的sdk与nuget)。

票数 0
EN

Stack Overflow用户

发布于 2012-09-07 03:53:44

正如微软建议的:“Speech Platform Runtime 11和Speech Platform SDK 11不包括用于语音识别或语音合成(TTS或文本到语音)的运行时语言。您必须单独安装它们。”

我从这里安装了一种运行时语言:http://www.microsoft.com/en-us/download/details.aspx?id=27224,从而解决了同样的问题

票数 3
EN

Stack Overflow用户

发布于 2014-11-19 16:17:56

我遇到了类似的问题,并通过下载正确的运行时解决了它。

首先,我下载了"MSSpeech_SR_en-CA_TELE.msi“,这是语音识别文件。您需要下载启动了MSSpeech_TTS的语言包,而不是语音识别包中的MSSpeech_SR。

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11083302

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档