DotDragnet
May 23, 2012, 09:27:24 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: follow us on twitter @dotdragnet
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Problems with javax.speech  (Read 1463 times)
Tanthalas
Hero Member
*****
Posts: 1019



View Profile WWW Awards
« on: July 12, 2007, 10:22:20 AM »

OK, so I'm wanting to mess around with Java's speech capabilities - see what can be done.  I've found FreeTTS, and I grabbed the JSAPI.jar file out of their distribution.  I stole a few HelloWorld programs from the Java Speech API Programmer's Guide, put them into IDEA, added the JSAPI.jar as an external JAR library and hit "Run."  On both programs I get a NullPointException when allocate() is called on the synthesizer and recogniser created by javax.speech.Central.  The synthesis program is shown below.  No syntax errors inside IDEA or Eclipse.  When I try to compile from the command line, the compile succeeds, but at runtime I get a NoClassDefFoundError on javax.speech.EngineModeDesc, despite it being part of the included JAR.

The heck?  Anyone got any ideas as to why this is happening?  Can't find anything on Google.

TIA

Code:
import javax.speech.*;
import javax.speech.synthesis.*;
import java.util.Locale;

public class HelloWorld {
public static void main(String args[]) {
try {
// Create a synthesizer for English
Synthesizer synth = Central.createSynthesizer(
new SynthesizerModeDesc(Locale.ENGLISH));

// Get it ready to speak
synth.allocate();
synth.resume();

// Speak the "Hello world" string
synth.speakPlainText("Hello, world!", null);

// Wait till speaking is done
synth.waitEngineState(Synthesizer.QUEUE_EMPTY);

// Clean up
synth.deallocate();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Logged

Aperture Science
We do what we must because we can
For the good of all of us, except the ones who are dead.
But there's no sense crying over every mistake
You just keep on trying 'til you run out of cake
And the science gets done, and you make a neat gun
For the people who are still alive
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!