Speech Recognition Sample
This sample demonstrates the capabilities of the Speech API.
To get samples and instructions for installing them
Do one or more of the following:
On the Help menu, click Samples.
The Readme displays information about samples.
Visit the Visual Studio 2008 Samples Web site. The most recent versions of samples are available there.
Locate samples on the computer on which Visual Studio is installed. By default, samples and a Readme file are installed in drive:\Program Files\Microsoft Visual Studio 9.0\Samples\lcid. For Express editions of Visual Studio, all samples are located online.
For more information, see Visual Studio Samples.
This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.
To view the sample documentation
In Solution Explorer, double-click the Documentation folder.
If you are using Visual Basic Express, right-click ReadMe.htm in the Documentation folder and then click View in Browser. If you are using another version of Visual Basic, double-click ReadMe.htm in the Documentation folder.
This sample demonstrates the capabilities of the Speech API (SAPI), which is included with Microsoft Windows XP Tablet PC Edition 2005. SAPI is a rich and similar enough to the handwriting recognition APIs that it can be easily learned by developers programming for Windows XP Tablet PC Edition 2005.
You must create an interop wrapper for the SAPI DLL. You can do this by adding a reference, clicking the COM tab, and then selecting Microsoft Speech Object Library. After you do this and the SpeechLib namespace is imported, developing for SAPI is similar to developing for handwriting recognition by using the Tablet PC Platform SDK. A recognizer is created (in this case, an in-process SpInProcRecognizer) and generates a context (of type SpInProcRecoContext) that is associated with the specific type of recognition. Events associated with the recognition process include the Hypothesis, Recognition, and EndStream events. A large number of Hypothesis events will be generated, although only one Recognition and EndStream event will be associated with a particular recognition attempt.
The sample provides a standard file dialog box to open a user-supplied .wav file. The sample application attempts to recognize the speech in this file, and the results are added to a RichTextEdit box. The technique for iterating over alternative possibilities is also shown, although that output is directed to the Debug console.
This sample requires that the following be installed:
Windows XP Tablet PC Edition 2005