首页 新闻 赞助 找找看

文字转语音程序奔溃

-2
悬赏园豆:100 [已关闭问题] 关闭于 2018-01-23 17:51

各位大神求助:
我用WPF写了个TTS,应用微软SpeechSDK5.1下的sapi.dll库,引用进行项目编译后生成了Interop.SpeechLib.dll,window7 64位家庭版系统下运行正常,在window 32旗舰版运行程序直接崩掉,求解决方法,系统日志如下:
Application: TTS.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException
Stack:
at SpeechLib.SpVoiceClass.Speak(System.String, SpeechLib.SpeechVoiceSpeakFlags)
at TTS.MainWindow.Button_OnClick(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
at System.Windows.UIElement.OnMouseUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at TTS.App.Main()

我就是阿木木的主页 我就是阿木木 | 初学一级 | 园豆:106
提问于:2018-01-18 16:52

问题已解决,实际上计算机缺少了相关的语音引擎,有些操作系统有文字转语音类型但缺少相对应的的语音引擎,例如我这个问题是默认选中第一个的是Microsoft Lili类型,恰巧缺少该类型的语音引擎(控制面板\轻松访问\语音识别 文字到语音转换),而程序内在没有指定语音类型情况下会使用默认第一种类型,这样导致程序奔溃,至于为啥报的是System.Runtime.InteropServices.COMException这个还需要查阅内部实现

水王飞仔 6年前
< >
分享
所有回答(3)
0

编译时的目标平台选的是什么?

dudu | 园豆:31075 (高人七级) | 2018-01-18 16:55

X86,X64我都试过了

支持(0) 反对(0) 我就是阿木木 | 园豆:106 (初学一级) | 2018-01-18 16:56

@水王飞仔: AnyCPU试过了吗?

支持(0) 反对(0) dudu | 园豆:31075 (高人七级) | 2018-01-18 17:04

@dudu: 刚刚也试过了,用x86,AnyCPU是可以运行程序,但是一调用文字转语音接口程序就奔溃了,x64在32位平台是是运行不了的

支持(0) 反对(0) 我就是阿木木 | 园豆:106 (初学一级) | 2018-01-18 17:07

@水王飞仔: 试试 Run as administrator

支持(0) 反对(0) dudu | 园豆:31075 (高人七级) | 2018-01-18 17:09

@dudu: 都试过了

支持(0) 反对(0) 我就是阿木木 | 园豆:106 (初学一级) | 2018-01-18 17:24
0

we文字转语音.你为什么不试试百度翻译呢?

吴瑞祥 | 园豆:29449 (高人七级) | 2018-01-18 17:09

百度翻译?没懂

支持(0) 反对(0) 我就是阿木木 | 园豆:106 (初学一级) | 2018-01-18 17:25

我知道了,百度翻译有api吗

支持(0) 反对(0) 我就是阿木木 | 园豆:106 (初学一级) | 2018-01-18 17:52

@水王飞仔: 没有你直接把要转成语音的文字加在text后面就行了.

http://fanyi.baidu.com/gettts?lan=zh&text=132231&spd=5&source=web

支持(0) 反对(0) 吴瑞祥 | 园豆:29449 (高人七级) | 2018-01-18 20:03

@吴瑞祥: 考虑到上不了网的情况,这个就有点尴尬

支持(0) 反对(0) 我就是阿木木 | 园豆:106 (初学一级) | 2018-01-19 09:49
0

问题已解决,实际上计算机缺少了相关的语音引擎,有些操作系统有文字转语音类型但缺少相对应的的语音引擎,例如我这个问题是默认选中第一个的是Microsoft Lili类型,恰巧缺少该类型的语音引擎(控制面板\轻松访问\语音识别 文字到语音转换),而程序内在没有指定语音类型情况下会使用默认第一种类型,这样导致程序奔溃,至于为啥报的是System.Runtime.InteropServices.COMException这个还需要查阅内部实现

我就是阿木木 | 园豆:106 (初学一级) | 2018-01-23 17:51
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册