Hello,
Here’s the same video tutorial but with higher video quality. For more info about the tutorial, please check the original post here.
Download Sphinx 4.0 Video Tutorial
File Details :
Name : Sphinx-Tutorial.avi
Size : 334 MBs
Duration : 26:14 Minutes
Dimensions : 1280 x 800

hi, this is great.
i try to learn how use this in netbeans but i have some problems.
can you show how i can do that?
thx
how can run sphinx4 in Jcreator or netbeans?
thanks
Hello Jose and Nassir,
Thanks for posting, !
Simply add the 4 required Libraries & any Acoustic model library (depending on your projects requirements) to Project and run the any of the provided demo, It will work.
Required Libraries :
sphinx4.jar
tags.jar
jsapi.jar
js.jar
Acoustic Model Libraries :
TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
Steps to add Library to Project’s CLASSPATH :
In the Projects window, right-click the project node and choose Properties.
Click Libraries in the left panel of the Project Properties dialog box.
Adding library path in the right panel.
Best of luck!
hi Puneet Kalra.
thx for answer.
I have a problem, i try add HelloWorld in the librery, but i can see this.
do you know why, or how i can run “HelloWorld”?
thx man
i put “HelloWorld.java” in the packet of proyect and say this:
run:
Exception in thread “main” java.lang.NullPointerException at edu.cmu.sphinx.util.props.SaxLoader.load(SaxLoader.java:71)
at edu.cmu.sphinx.util.props.ConfigurationManager.(ConfigurationManager.java:59)
at voz3.HelloWorld.main(HelloWorld.java:33)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Hello again,
HelloWorld demo requires three files :
HelloWorld.java
hello.gram
helloworld.config.xml
And, these three files must be in the same folder. I guess, Program is unable to find the config file that’s why its showing up this error.
Also, make sure you have add “-mx256m” in VM options, you can find it under “Run” section of Project properties.
Hope this works for you!
hi puneet
how can modify on the HelloWorld.jar
i no see the code in this when i open the
HelloWorld.jar i find
three file
HelloWorld.class >>> no java
hello.gram
helloworld.config.xml
how can change this into java until i can see the code
and change about it.
Hello Nassir,
Well, you can download the Source of Sphinx 4.0 .. or the complete package, bin n src too.
Source of HelloWorld.jar is provided in package.
Regards,
hey, how to add new words to which will be spoken by user?
Hai Puneet..
I juz want to know which file i need to edit to change all the words in HelloWorld.jar.
For eg:
Hello Bhiksha change to Congratulation Danny
Could u please tell me.TQ
Hey Shri and CT,
@Shri, This post is for you : http://puneetk.com/expanding-dictionary-of-acoustic-model
@CT, you will have to edit the grammar file. I guess its “hello.gram” in HelloWorld.jar But i will suggest you to download Sphinx SRC and copy HelloWorld demo files from there. Or you can get it from Sphinx SVN.
Regards,
I would like to say “wow” what a inspiring post. This is really great. Keep doing what you’re doing!!
Hi Puneet!
It’s great job! I got much useful information. Thank you!
There is a question was born. Can I creat my own acoustic model for, for example, Uzbek language? And what steps should I pass by?
Thank you!
Hey Islam,
Thanks buddy
Well, Creating your own acoustic model isn’t a simple process. Check out “Sphinx Train” section on CMUSphinx’s website.
BUT, if you have only few words to work on ( in Uzbek language ). Then This post is for you : http://puneetk.com/expanding-dictionary-of-acoustic-model
Best of luck !
Hello puneet,
Firstly, thank you very much for your video & illustration .. but I tried it & got Null pointer exception in the allocation of recognizer , so How can I solve this problem ? .. I’d be grateful if you give me a reason for this Null pointer exception …
Thanks alot
Islam yousry
I have imcluded all the 4 jars inthe build path. But why does this error show up. TIDIGITS exists in my lib folder as a build path also.
Loading Recognizer as defined in ‘file:/C:/Users/btariq/workspace/shinxwav/bin/wavfile/config.xml’…
class not found !java.lang.ClassNotFoundException: edu.cmu.sphinx.model.acoustic.TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model
Exception in thread “main” Property Exception component:’flatLinguist’ property:’acousticModel’ – mandatory property is not set!
edu.cmu.sphinx.util.props.InternalConfigurationException
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:291)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.setupAcousticModel(FlatLinguist.java:278)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:244)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:460)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:279)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchManager.java:179)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:460)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:279)
at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:65)
at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:37)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:460)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:279)
at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:90)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:460)
at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:161)
at wavfile.WavFile.main(WavFile.java:45)
hi,
i m using sphinix4 with netbeans
import javax.speech.*;
import javax.speech.recognition.*;
import java.io.FileReader;
import java.util.Locale;
public class Main extends ResultAdapter
{
static Recognizer recognizer=null;
String gst;
@Override
public void resultAccepted(ResultEvent re)
{
try {
Result res = (Result)(re.getSource());
ResultToken tokens[] = res.getBestTokens();
// String args[]= new String[1];
gst=”";
for (int i=0; i < tokens.length; i++)
{
gst = tokens[i].getSpokenText();
gst = gst+" ";
System.out.print(gst + " ");
}
System.out.println();
if(gst.equals("exit"))
{
recognizer.deallocate();
// args[0]="next??";
// System.out.println(args[0]);
//Lee.main(args);
System.exit(0);
}
else
{
//recognizer.suspend();
//Lee.main(args);
// recognizer.resume();
}
}catch(Exception ex)
{
System.out.println("exception " + ex);
}
}
public static void main(String args[])
{
try
{
recognizer = Central.createRecognizer(new EngineModeDes(Locale.ENGLISH));
System.out.println("rec = "+recognizer);
if(recognizer != null) {
System.out.println("desc= "+recognizer.getEngineModeDesc());
}
}
catch(Exception e2)
{
System.out.println("h1");
}
try{
recognizer.allocate();
}
catch(Exception e1)
{
System.out.println("error"); }
}
}
than in output exception is generated like
rec=null
error
can u help me out…
hi again
i had also tried code of helloworld of sphinix4 package
o/p:–
Exception in thread “main” java.lang.RuntimeException: searchManager: allocation of search manager resources failed
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:643)
at edu.cmu.sphinx.decoder.AbstractDecoder.allocate(AbstractDecoder.java:87)
at edu.cmu.sphinx.recognizer.Recognizer.allocate(Recognizer.java:168)
at javaapplication9.Main.main(Main.java:32)
Caused by: java.io.FileNotFoundException: C:\Users\Chirag\Documents\NetBeansProjects\JavaApplication9\build\classes\edu\cmu\sphinx\demo\helloworld\hello.gram (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at java.net.URL.openStream(URL.java:1009)
at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:232)
at com.sun.speech.engine.recognition.BaseRecognizer.loadJSGF(BaseRecognizer.java:275)
at com.sun.speech.engine.recognition.BaseRecognizer.loadJSGF(BaseRecognizer.java:232)
at edu.cmu.sphinx.jsapi.JSGFGrammar.commitChanges(JSGFGrammar.java:564)
at edu.cmu.sphinx.jsapi.JSGFGrammar.createGrammar(JSGFGrammar.java:278)
at edu.cmu.sphinx.linguist.language.grammar.Grammar.allocate(Grammar.java:116)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.allocate(FlatLinguist.java:300)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:639)
… 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 9 seconds)
plz help me out
[i m eng student & it's my prefinal year proj]
Hey Bilal and Chirag,
Problem is with config.xml part.
For Bilal, System is unable to locate the Acoustic Model file.
For Chirag, Decoder is unable to load the Search Manager as one of its major resource (the gram file) is not available.
Now for both of you, As your code shows, you guys are trying to run demos provided by Sphinx4. So i will suggest you NOT to change the package of classes.
Because if you change/remove package, you will have to manipulate the resource locations in config.xml file.
Hope it works ! Any Queries? Feel free to post.
Regards,
Well i am not sure. the TIDIGITS jar is placed in the ‘lib’ folder of my source folder. What needs to be changed in the config.xml. The acoustic model component shows ‘edu.cmu.sphinx.acoustic.TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model’ as type.