Export (0) Print
Expand All
Expand Minimize

Using the Code Examples (SAPI 5.4)

Speech API 5.4
Microsoft Speech API 5.4

Using the Visual Basic Code Examples

Prerequisites

To run the code examples contained in this documentation, your computer must have the following installed:

  • SAPI 5.1 or later
  • Visual Basic 5.0, Visual Basic 6.0, or Visual Basic.Net
  • Speakers

A microphone is helpful, but not necessary, for demonstrating speech recognition.

Getting Started

The code examples in this document are designed for use with Microsoft Visual Basic. Each example is identified either as a "code snippet" or as "form code." Code snippets are small sections of code intended to be placed within a single Visual Basic procedure; form code examples are designed to be placed within a Visual Basic form. All forms, modules, controls and resources use Visual Basic's default names, such as form "Form1," command button "Command1," and resource "101."

Following are the normal steps for running a code example:

Opening a project in Visual Basic
  1. Open Visual Basic.
  2. In the New Project dialog box, double-click Standard exe.
  3. Visual Basic will display a new form called Form1.
Adding a "code snippet" example to the project
  1. Double-click on Form1 to display the code.
  2. Select the example code from the documentation and copy (Ctl-C).
  3. Click inside the Form_Load procedure and paste (Ctl-V).
Adding a form code example to the project
If the code example uses controls, use the Toolbox to add them to Form1
  1. Double-click on Form1 to display the code.
  2. Select the example code from the documentation and copy (Ctl-C).
  3. Select all code in Form1 and paste (Ctl-V).

Adding a reference to SAPI
  1. From the Project menu, click References.
  2. In the References list box, select Microsoft Speech Object Library.
  3. Click OK.

About the Examples

Recognition of text-to-speech voices

Several of the speech recognition code examples perform recognition of audio files created by text-to-speech (TTS) voices. Speech recognition is designed to recognize human voices rather than TTS voices, so the quality of recognition from TTS voices is not as high as that from human voices; however, TTS voices are also much more consistent than human voices. Some code examples need to demonstrate types of recognition result data that are dependent on subtle factors in the speaking voice. In the instances where TTS recognition takes place, users can enter their own text. In some cases, it may be difficult to find a phrase that will produce a particular recognition result from a TTS voice. Once such a phrase is known, a TTS voice speaking that phrase will reproduce those results very consistently. Most of these types of results would be very difficult for a user to reproduce by speaking into a microphone.

Show:
© 2014 Microsoft