How To
Write Your
Own Application Programs
Recognition
(Entry at
Relocation
+3)
Now
you
are ready to
recognize words. When
you want a verbal input,
it
helps to
instruct the
user by printing a cue on the Video Display,
such as
"SPEAK . .
."
or
"YOUR MOVE
..."
or
"CONTINUE." If the
words
are
easily
forgotten, it may
help to print
on the display
a
partial list
of those
that the VOXBOX can recognize
as a reminder.
In
recognition,
the user
function instructs the VOXBOX
to listen.
When a
word is
detected, the
number (index) of this
word
recognized
is returned
to you
in
a
specific
location in memory. You
will
use
PEEK to
get that
number.
If no
trained word
is
recognized but a word-like
sound
was
heard,
the
VOXBOX
will
return
a
"reject" code (Code 32 or 20
H
)
j
in
this
location.
The same code
is
returned if the word
or phrase
detected is
longer
than 1.5 sec.
The "speech
longer than 1.5 sees."
error can
result
from
using the
unit in a noisy environment.
To
interrupt
the system
(return to BASIC monitor) while
waiting
for a
speech input,
press down the
"BREAK"
key and say
a word
into
the
microphone (such as
"break").
This will
cause a
"break" to occur.
To
use the
recognition
routine, first set up a USR routine with
entry at
Relocation
+3.
Then call the
USR routine when
you want the user
say
the
word or
phrase.
Here is an
example you
might follow
for
recognizing the digits
and
1
as
they
were trained
above. The
addresses ADR
and TRA
were
computed
in the previous
routines, and do not have to
be computed
again
here.
400 REM GET VOICE
INPUT
410
POKE 16526,3
420 POKE 16527* AD
430 PRINT "SPEAK.
440 X
=
USR(0)
450 W
=
PEEK<TA>
460 IF W >
31 THEN GOTO
430
470 PRINT
"YOU
SAID"?
480 GOSUB
900: REM DELAY
490 GOTO
300
s REM GET NEXT WORD
900 REM DELAY
910 FOR
1=1
TO 300
920
NEXT
I!
RETURN
930
'
The
above examples of
the three elements of
speech recognition
can
be put
together (and slightly expanded) to yield
a demonstration
program which
will recognize
6
digits and
5 words.
24