Click here to Skip to main content
11,633,969 members (81,596 online)
Rate this: bad
good
Please Sign up or sign in to vote.
I developed a speech recognition program using SpSharedRecoContext.
The program works but is too slow. I thought I would change the program to use
SpInProcRecoContext which should provide better performance and quality. I expected
the change to be easy with some necessary tweeks.
However, I have encountered a problem that I can not understand.
I can demonstrate the problem with the following:
 
 Imports SpeechLib
 Dim WithEvents RC As SpInProcRecoContext
 Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
 RC = New SpInProcRecoContext '---- This line causes the following runtime exception:
 End Sub
 End Class
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147201021
Message=Creating an instance of the COM component with CLSID {73AD6842-ACE0-45E8-A4DD-8795881A2C2A} from the IClassFactory failed due to the following error: 80045003.
Source=WindowsApplication25
StackTrace:
at WindowsApplication25.Form1.Form1_Load(Object sender, EventArgs e) in c:\users\chuck\documents\visual studio 2010\Projects\WindowsApplication25\WindowsApplication25\Form1.vb:line 7
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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)
InnerException:

80045003 error is un SPERR_UNSUPPORTED_FORMAT ;"The caller has specified an unsupported format. "

If I change it to the following using SpSharedRecoContext, I get no runtime errors, and was the bases for
my Speech Recognition programs that is working.
 Imports SpeechLib
 Dim WithEvents RC As  SpSharedRecoContext
 Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
 RC = New  SpSharedRecoContext
 End Sub
 End Class
I have researched and have found that others have had similar problems
with SpInProcRecoContext, but I found no solutions.
I am running Windows 8 on the development system with Visual Studio 2010. Based on information,
I read on line, I removed and reinstalled Visual Studio 2010 and SDK . I took the
runtime and tried it on a Windows 7 system, with the same results. I download the trial
Visual Studio 2012 and got the same error. I have seen very similar code
on the Microsoft web site, so I don't think the issue is with the code.

However, the Microsoft example Set RC = New SpInProcRecoContext Set is used. When I include Set, VB
removes the Set from the code. I am not sure what that is about.

Can anyone provide me some insight on this problem? Thanks
Posted 19-Feb-13 7:03am
ChasHH526
Edited 19-Feb-13 7:45am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Why using SpeechLib, if you can use System.Speech.Recognition,
http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx[^]?

Use either System.Speech.Recognition.SpeechRecognizer or System.Speech.Recognition.SpeechRecognitionEngine, see the code samples. I worked with both, they work. You will find code sample on the MSDN help pages for these classes:
http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognizer.aspx[^],
http://msdn.microsoft.com/en-us/library/system.speech.recognition.speechrecognitionengine.aspx[^].

They have slightly different features and are designed for STA and MTA thread apartment states, so if your application uses different apartment state (for example, WPF only works with STA), you will need to use a separate thread for recognition. They are using the same engine, anyway.

The assembly "System.Speech.dll" is installed in GAC, so you reference it through the tab ".NET" of the VS "Add reference" window.

Good luck,
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,658
1 Sergey Alexandrovich Kryukov 8,204
2 Mika Wendelius 6,645
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 2,095


Advertise | Privacy | Mobile
Web01 | 2.8.150728.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100