Speech List Box for Visual Basic
Introduction
Speech List Box for Visual Basic is an elementary application showcasing speech recognition (SR) and dynamic grammars.
In general, a grammar is the set of words that the engine can recognize. In the case of dictation, all words are in the grammar and no limitation is imposed on the user. In the case of command and control applications, the list of words is much more restricted. For example, a grammar containing commands to operate a menu system, might include less than a dozen words, each word corresponding to a menu or menu item. Often, this list of words is generated ahead of time and represents a static or fixed grammar. However, dynamic grammars allow users to add words while running the application. This permits users to customize the grammar according to their needs. The list box sample demonstrated making and maintaining a dynamic grammar.
Using Speech List Box for Visual Basic
Speech List Box for Visual Basic opens with no words in the dynamic grammar. You can add words or phrases by typing the text in the edit box and clicking Add. After adding at least one item, individual items may be highlighted by saying, "select" followed by the text of the item. For example, if one of the items a list of cities were Seattle, saying "Select Seattle" will choose the Seattle item.
Add
Use Add to move the text in the edit box to the display area. The text can be either a single word or a phrase.
Remove
Use Remove to remove the selected item in the display area from the dynamic grammar. Highlight the item to be removed.
Speech Enabled
Use Speech Enabled to enable the speech recognizer. By default it is on and the speech engine will attempt to recognize voice commands. Disabling this option prohibits recognition attempts. Regardless of the recognizer state, if no items have been added to the display area, no recognition will occur.
Exit
Click the close box in the title bar to exit Speech List Box for Visual Basic.
Compile
Speech List Box for Visual Basic is actually two projects running at the same time. To compile them, open ListboxSample.vbg instead of a vbp file. One project is the application itself. However, the display area is actually a control component. By running ListboxSample.vbg, the control component is actually loaded and registered for the computer.
Speech List Box for Visual Basic is a standard Visual Basic application and does not require additional special support. However, Visual Basic 6 Professional, Enterprise or later must be used to compile this example. Visual Basic 6 Learning Edition does not supply all the needed ActiveX Controls for the sample.
To compile correctly, the Speech reference must be active; see Creating a Speech-Enabled Visual Basic Project in Using the Visual Basic Code Examples for details to speech enable Visual Basic applications. Additionally, the samples are installed as Locked files. To modify them, they must be unlocked. To unlock, right-click the file or files, select Properties, and clear the Read-Only check box.