Getting started with Sphinx 4 :: HelloWorld!!
Published by admin June 30th, 2006Sphinx is a HMM based speech recognition system developed at CMU. There are 4 versions of Sphinx. For the moment, I’m exploring Sphinx-4 because it is written in Java, and it would probably combine easiest with the Video Comments work being done at ITP.
Getting everything you need to run Sphinx 4
First, download the bin (or the source if you want to compile everything yourself) of Sphinx 4 at sourceforge.
Then, to run any speech applications in Java, whether they be speech recognition or text to speech, you must get the Java Speech API setup.
After downloading the Sphinx-4 bin, you need to “unpack” the jsapi.jar by signing a BCL license. Instructions for setting up the JSAPI 1.0 for UNIX and Windows systems are here, but I’ll repeat how I set up on my Mac right here for good measure:
In Terminal, change directory to the lib folder in the Sphinx-4 package that you downloaded where the jsapi.sh file sits.
cd sphinx4-1/sphinx4-1.0beta/lib
If you type ls, you should see a file called jsapi.sh in this directory.
Then type chmod +x ./jsapi.sh
Then type sh ./jsapi.sh
A long document that is the BCL license should show up. Scroll down to the end of it and agree to it by typing ‘y’ when prompted to do so. Then we you press enter, the jsapi.jar should be unpacked and ready in this same lib directory.
Move this jsapi.jar file to your Java Extensions folder ( yourComputer: System/Library/Java/Extensions ). Now your computer should know how to talk with Java!
Now run some demos!
To make sure everything is set up correctly, we can now run the demos that came with the Sphinx-4 download. In the bin directory, let’s run the HelloWorld.jar that came with the package. In this application, there are a fixed vocabulary of words that you can speak for your computer to hear.
Run it in terminal by changing directory to the bin folder ( sphinx4-1/sphinx4-1.0beta/bin ) and then launch the HelloWorld app by typing java -mx312m -jar HelloWorld.jar A more in depth tutorial about running the HelloWorld.jar and the app does is on the Spinx website.