我正在使用 Microsoft.Speech SDK (11.0) 将文本转换为语音。我有一个 Windows 窗体应用程序,我正在使用一个非常基本的代码来说出输入的文本,但是它失败了。这是我单击按钮时的代码:
SpeechSynthesizer syn = new SpeechSynthesizer();
PromptBuilder pb = new PromptBuilder();
pb.AppendText("Welcome, everyone");
syn.Speak(pb);
错误发生在上述代码的最后一行:
FileNotFoundException was unhandled
Exception from HRESULT: 0x8004503A
这是完整的堆栈跟踪:
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()
是什么导致了这个错误?
谢谢