(Pic. 3) With the Code Window Select DirectSR1 in top left pull down
menu and select PhraseFinish in the top right pull down menu.
When you select PhraseFinish, the code that is put in place for you is the following:
Private Sub DirectSR1_PhraseFinish(ByVal flags As Long, _
ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, _
ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results
As Long)
'''' End Code
There's a lot of parameters you say. But don't be frightened! We only need
to be concerned with the Phrase parameter; this will contain the recognized
word that was processed by the DirectSR engine.
Now that we got that set up, we will have to input a set of words for the Speech
Engine to recognize. The job is very simple, we just feed in the set of words
during the Form's Onload procedure. But how do we do that you ask? Simple, DirectSR
have two ways for you to feed the words in, they are DirectSR1.GrammarFromString
which takes in a String variable that contains the words and DirectSR1.GrammarFromFile
which takes in a file path to a file that contains the words in a text file.
Simple enough? The method we will use is DirectSR1.GrammarFromString
because this provides the greatest flexibility because you can dynamically add
additional words to the engine and still add words in from a file like DirectSR1.GrammarFromFile
by putting the text in the file into a variable.
Comments