August 18 - Speech Recognition

posted Aug 18, 2010, 7:46 PM by Unknown user
Today I worked on the speech recognition part of my final. I used the voce library ( to set up a simple test app which recognizes the two phrases required for the project and reads them back for confirmation. For this to run, a few things need to be done: the voce library must be unzipped to the "libraries" directory in the sketchbook folder, the sketch must be in a folder called SpeechRec in the sketchbook (or if it isn't the path in the code should be changed accordingly), and in the sketch folder, a folder named "grammar" must be created, with a file called "test.gram" inside it, containing the code in this post. Likewise, there is a setting in preferences to increase the memory that your sketch uses to 256 mb - this needs to be checked, otherwise your sketch will get an Out Of Memory error. Thanks to the nice folks in this thread at for supplying the info needed to get this library up and running. I attached a short swf video of myself saying the phrases into my laptop mic to demonstrate.

Processing Sketch:

import voce.*;

void setup() {
  voce.SpeechInterface.init("../Users/Joseph/Documents/Processing/libraries/voce/lib", true, true, 
 "../Users/Joseph/Documents/Processing/SpeechRec/grammar", "test");
  System.out.println("This is a speech recognition test. ");
void draw() { 
  while (voce.SpeechInterface.getRecognizerQueueSize() > 0){
    String s = voce.SpeechInterface.popRecognizedString();
    println("You said: " + s);


#JSGF V1.0;

grammar Test;

public <TEST> = (I solemnly swear that I am up to no good | mischief managed) * ;

Unknown user,
Aug 18, 2010, 8:17 PM