The SAPIListBox is a simple and effective way to add voice recognition / speech recogition to your AutoIT script. I personally have found this method of speech recognition to be even more accurate than via the other tools and methods within the SAPI SDK.
The SAPIListBox looks like any other traditional ListBox (ie. AutoIT's "GUIListBox"). However it is voice sensitive. When the listbox is active, it listens to your microphone, and if a spoken word matches an item within the listbox (via Microsoft's Speech API), then that item is automatically selected. My UDF also includes the ability to detect this change in the listbox, so a script can then perform a particular action once the word is spoken.
I'd used the SAPIListBox with great success in a MS Access application previously. I thought I'd port it to AutoIT just for the fun of it
If you find that the speech recognition capability of this UDF is not that accurate, then go to your Windows Control Panel and open the "Speech" applet. A "Speech Properties" window will be displayed. Click the "Train Profile..." button to train the Speech API to understand your own voice better. Once you have finished this, retry this UDF. You should notice an improvement in speech recognition.
REQUIREMENTS:
AutoIt3 3.2 or higher
the Microsoft Speech SDK 5.1 (a 68 MB free download)
LIST OF FUNCTIONS:
EXAMPLES:_GUICtrlSAPIListBox_Create($left, $top, $width, $height, $enable_speech = True, $enable_listbox = True, $hide_listbox = False, $items = False)
_GUICtrlSAPIListBox_EnableSpeech($SAPIListBox, $toggle)
_GUICtrlSAPIListBox_Enable($SAPIListBox, $toggle)
_GUICtrlSAPIListBox_Hide($SAPIListBox, $toggle)
_GUICtrlSAPIListBox_AddString($SAPIListBox, $text)
_GUICtrlSAPIListBox_DeleteString($SAPIListBox, $index)
_GUICtrlSAPIListBox_GetSel($SAPIListBox, $index)
_GUICtrlSAPIListBox_InsertString($SAPIListBox, $text, $index)
_GUICtrlSAPIListBox_SetToolTip($SAPIListBox, $text)
_GUICtrlSAPIListBox_AddString($SAPIListBox, $array)
_GUICtrlSAPIListBox_GetCount($SAPIListBox)
_GUICtrlSAPIListBox_GetText($SAPIListBox, $index = -1)
_GUICtrlSAPIListBox_GetNewIndex($SAPIListBox)
_GUICtrlSAPIListBox_Refresh($SAPIListBox)
_GUICtrlSAPIListBox_ResetContent($SAPIListBox)
_GUICtrlSAPIListBox_CurSelChanged($SAPIListBox)
SAPI_SpeechProperties()
You must have downloaded and installed the Microsoft SAPI 5.1 SDK (in the Requirements section above) prior to running these examples, or using the UDF.
The following example demonstrates the full set of functions in the UDF. When the script is run, a GUI is displayed. The user should be able to immediately begin talking into the microphone, reciting any of the words listed in the SAPIListBox. If a word is spoken correctly, that word should get automatically selected in the listbox. The bottom half of the GUI will display changes (as the user speaks the correct words), and also allow the user to add and remove words, and adjust other listbox properties. Clicking the "Speech Properties" button will display the settings for SAPI, and allow users to train the speech engine to better recognise their own voice.
SAPIListBox control Test.au3 5.51K
978 downloadsThe following example is of a voice activated application launcher. When the script is run, a GUI is displayed. The user should be able to immediately begin talking into the microphone, reciting any of the words listed in the SAPIListBox. If a word is spoken correctly, the corresponding application should start. Clicking the "Speech Properties" button will display the settings for SAPI, and allow users to train the speech engine to better recognise their own voice. Saying the word "close" should close the active window (as launched with a previous voice command).
voice activate app launcher.au3 2.19K
857 downloadsDOWNLOAD:
Latest Version - v0.1 (21/05/10)
SAPIListBox.au3 18.66K
955 downloads
Edited by seangriffin, 21 May 2010 - 10:57 PM.







