Using Voice-activated Commands with the CAVE Collaborative Console

(Updated 10.15.99)

This page covers everything you need to set up your application to receive voice command input. We currently use it with LIMBO, but you should be able to set any CAVE application up like this.

Configuration and Components:

**Actually, catch.c is just an example. The actual procedure requires that you #include "catch.h" in your program and include a call to catchData(line, SIZE)

throw and catch

by: John Kelso

Catch & throw comprise a simple package to pass commands to a process. Throw receives input and passes it to the catch process, which receives the input. Catch and throw communicate via a Unix file socket.

Throw is a perl program that is run in a terminal window. It collects keyboard input, parses it, and when a command is matched, sends a text string via the socket. Throw is started on the command line with usage:

Throw reads a file called a "parse table" to configure its syntax. If no parse table is provided, a default table is used. The parse table is a list of Perl regular expressions. An example is given below. You can define as many commands as needed, but you must adhere to the variable names and syntax of the example.

Commands are of the form:
start-word whitespace command whitespace stop-word

Start-word and stop-word are strings that are specified by the parse table. In the default parse table, the start-word is "computer", and the stop-word is "please". A command is any text string surrounded by whitespace that is matched by a regular expression in the parse table. Each command in the parse table has a corresponding text string that is written to the socket. A special command, the first on one the parse table, is the command to terrminate the session. In the default parse table the exit command is the word "exit". There is just one other command defined, which will match any input, and the text string is just a copy of the matched command.

For example, in the default case, if the input to catch is "computer display menus please", the text string "display menus" will be sent to the socket.

Here is an example of a parse table. Start is "foo", stop is "bar". The words "bye bye" (with any amount of whitespace between the words) will exit. Other commands match a number, or the phrases "menu on" and "menu off"

  $start = 'foo' ;
  $stop = 'bar' ;
  
  $strings[0] = 'bye\s+bye' ;
  $commands[0] = 'exit' ;
  
  $strings[$#strings+1] = '\d+' ;
  $commands[$#commands+1] = 'number' ;
  
  $strings[$#strings+1] = 'menu\s+on' ;
  $commands[$#commands+1] = 'menuOn' ;
  
  $strings[$#strings+1] = 'menu\s+off' ;
  $commands[$#commands+1] = 'menuOff' ;

Catch is a set of three subroutines written in C. To use it in your program,you include the header file catch.h, and call the three routines, which are:

void catchInit( )
	make the connection to throw
int catchData(char line[size], size)
	return up to size bytes of data in line,
	or zero is no data has been sent
void termCatch( )
	disconnect from throw

Playing catch with the Console

The Console uses a file called listen.h++ to receive parsed input from catch.   listen.h++ then passes each command to the appropriate statement in processor.c++, giving it a pointer to the console, the enumarated command name, and the parameters of the command.   processsor.c++ uses this information to invoke the command on the Console.   This routine makes up the "Input Translation Protocol" portion of the OOP Design Diagram.

Back to the CCC homepage