Null pointer when trying to initialise speech recognition

Hi all,

I am attempting to utilise the JSAPI for a project for display at my Uni that utilises freeTTS and also some Java speech recognition. Through the tutorials online (such as the Hello World) I have built my speech recognizer but as I try to allocate() for the speech recogniser the program gives me a null pointer.

The grammar file that I load into the file reader exists and I do not get a file not found exception. Can anyone see a blindingly obvious error that I am missing?

Code below. The rec.allocate() (third line after the try... is where i am getting my null pointer from.

Cheers

Mark

public BigEars(SpeakEasy gui){

mainGui = gui;

try{

EngineModeDesc desk =new EngineModeDesc(Locale.ENGLISH);

rec = Central.createRecognizer(desk);

rec.allocate();

FileReader reader =new FileReader("speechRecog/grammar.txt");

RuleGrammar rules = rec.loadJSGF(reader);

rules.setEnabled(true);

rec.addResultListener(this);

rec.commitChanges();

rec.requestFocus();

rec.resume();

}

catch (Exception e){

message("There is a problem with this code.");

e.printStackTrace();

}

}

[1663 byte] By [Knightsa] at [2007-11-26 18:07:29]
# 1
Hello Mark!i am also facing this problem , i hav tried another package of speech apibut could'nt be to create an engine yet !!please anyone help us !! thx
dheeraj_chda at 2007-7-9 5:38:51 > top of Java-index,Security,Cryptography...
# 2

Hi dheeraj_chd,

I never got a reply to this so to move forward I actually incorporated the Sphinx4 speech recognition program into my project. I do not know if this is any help to you but I got it up and running OK with it.

http://cmusphinx.sourceforge.net/sphinx4/

I hope this helps. It does dramatically increase the size of the application you are writing but at least it works!

Cheers

Mark

Knightsa at 2007-7-9 5:38:51 > top of Java-index,Security,Cryptography...