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 or View on Megavideo
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.
any response??
Hey,
In Grammar’s config, You have change value attribute.
resource:/pack.sub.pack.CLASS!/pack/sub/pack/ < This is how it works !
Best of luck !
hi puneet,
while going through the following tutorial : http://www.lilwondermat.com/chatter/downloads/eclipse.pdf
i noticed at page 2, it says ‘edu.cmu.sphinx.model directory’ is created after running build.xml.However, this did not happen when i ran build.xml. Any suggestion most probably this might have been the error to the previous question.
any suggestions????
Thank you very much! I’m working on a project with some other classmates and you helped us make a very big step!
Grtz,
Vishaal
hii,
i m doing an application using sphinx4, on running it i m encountering the followin in the console….
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 game.hellongram.HelloNGram.main(HelloNGram.java:40)
HELP ME PLZZZZ!!!
Hey Vishaal, Pleasure mate and best of luck for your project.
Hello Archana, are you trying to run the exact same “HelloNGram” example or you have made any changes ?
If its same, Make sure you keep the same package as given in example, As i can see you have changed the package “game.hellongram” Or change the resource location in config file.
Or if you have made any changes, Please discuss the changes here
Regards,
class not found !java.lang.ClassNotFoundException: edu.cmu.sphinx.model.acoustic.WSJ_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)
Hey Ramana,
“.. Property Exception component:’flatLinguist’ property:’acousticModel’ – mandatory property is not set.. ”
AcousticModel is not found, Possible reason, you forgot to import AcousticModel jars to project’s CLASSPATH.
Make sure you follow all the steps and if you are trying any of the examples provided on CMUSphinx site, then keep the package of classes as they are.
Hope it works for you !
If you any questions, Please feel free to ask.
Regards,
Hey Puneet,
I have a small project to done using Sphinx . Will you be interested. You can email me your interest to prem dot 2222 dot apple at gmail dot com
Its an urgent work.
Hi there, i’m new in java and sphinx, and i just installed Sphinx4 and builded the demos with ant. Everything was ok for the non-jsapi demos, but the jsapi ones returned errors:
[javac] Compiling 2 sources files to C:\Sphinx4\bld
[javac] C:\Sphinx4\src\apps\edu\cmu\sphinx\demo\jsapi\dialog\Dialog.java
[javac] C:\Sphinx4\src\apps\edu\cmu\sphinx\demo\jsapi\dialog\DialogManager.java
[javac]
C:\Sphinx4\src\apps\edu\cmu\sphinx\demo\jsapi\dialog\Dialog.java:23: package com.sun.speech.engine.recognition does not exist
[javac] import com.sun.speech.engine.recognition.BaseReconizer;
[javac] ^
[javac]
C:\Sphinx4\src\apps\edu\cmu\sphinx\demo\jsapi\dialog\Dialog.java:24: package com.sun.speech.engine.recognition does not exist
[javac] import com.sun.speech.engine.recognition.BaseRuleGrammar;
[javac] ^
…
and so on
I installed jsapi that came with sphinx and put it on lib folder. I didnt change any package of classes. Do u have any ideas?
Thanks
Hello Fileh,
Its quite clear. Error says system is unable to locate the “com.sun.speech.engine.recognition” package. So that simply means, Some library is missing. So double check the require JAR files in library folder or try to add them to projects CLASSPATH.
I’m sure it will work !
Regards, ~P
F:\Program Files\Java\jdk1.6.0_20\bin>java -Xms32m -Xmx512m -classpath lib/jsapi.jar;lib/sphinx4.jar;lib/WSJ_8ga
u_13dCep_8kHz_31mel_200Hz_3500Hz.jar;. demo/sphinx/helloworld/HelloWorld
Loading….
Problem creating HelloWorld: java.lang.NullPointerException
java.lang.NullPointerException
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.loadProperties(Sphinx3Loader.java:272)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.getIsBinaryDefault(Sphinx3Loader.java:286)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.newProperties(Sphinx3Loader.java:245)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.TiedStateAcousticModel.newProperties(TiedStateAcousticMode
l.java:105)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.setupAcousticModel(FlatLinguist.java:220)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:184)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchM
anager.java:139)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:52)
at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:31)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:78)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163)
at demo.sphinx.helloworld.HelloWorld.main(HelloWorld.java:33)
plz tell me what wrong?
hi puneet
I followed your video tutorial. HelloWorld runs without any exception. But it is not responding for any input. Even for Ctrl-C. Any suggestion..
/regards
F:\Program Files\Java\jdk1.6.0_20\bin>java -Xms32m -Xmx512m -classpath lib/jsapi.jar;lib/sphinx4.jar;lib/WSJ_8ga
u_13dCep_8kHz_31mel_200Hz_3500Hz.jar;. demo/sphinx/helloworld/HelloWorld
Loading….
Problem creating HelloWorld: java.lang.NullPointerException
java.lang.NullPointerException
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.loadProperties(Sphinx3Loader.java:272)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.getIsBinaryDefault(Sphinx3Loader.java:286)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.newProperties(Sphinx3Loader.java:245)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.TiedStateAcousticModel.newProperties(TiedStateAcousticMode
l.java:105)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.setupAcousticModel(FlatLinguist.java:220)
at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:184)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchM
anager.java:139)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:52)
at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:31)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:271)
at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:78)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:421)
at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163)
at demo.sphinx.helloworld.HelloWorld.main(HelloWorld.java:33)
hi Puneet Kalra.
thank you for answer.
i need to develop speech recognition application that will recognize arabic languages
so i need some help from you
hi Puneet Kalra
thank u for your answer
i want to build speech recognition application
that can recognize african language eg Geez
so i need some help from u
thank you!
Hi Puneet,
I was trying to build an example which uses freetts and sphinx.
But i am getting Exception in thread “AWT-EventQueue-0″ java.lang.NoSuchFieldError: engineListeners
at com.sun.speech.engine.recognition.BaseRecognizer.fireRecognizerSuspended(BaseRecognizer.java:922)
at com.sun.speech.engine.recognition.BaseRecognizer.dispatchSpeechEvent(BaseRecognizer.java:1262)
at com.sun.speech.engine.SpeechEventUtilities$SpeechAWTEventTarget.processEvent(SpeechEventUtilities.java:219)
am using freetts-1.2 and sphinx4 related jars.
I looked into jsapi impl of both frameworks
the jsapi implementation of BaseEngine which contains engineListners in freetts and sphinx differs. It is defined as Collection in freetts and Vector/List in sphinx4
Please guide me on this.
Thanks & Regards
Hi puneet,
I tried to run the HelloWorld example of sphinx.
It is giving random results like eventhough i did not speak any word it is giving some random word from my hello.gram. And some times it gives some different word other than i spoke.
why this varied behabiour.
Thanks & Regards
hello
thank you for a nice video.but when i implement it in netbeans the createRecognizers() return null.
Synthesizer synth = Central.createRecognizer(new SynthesizerModeDesc(Locale.ENGLISH));
can you tell me why i face the problem.
Hi Puneet,
I am doing my final year project named “Voice Command Module for OpenOffice writer application” for which we intend to use Sphinx4 as speech-to-text conversion. Both OpenOffice and Sphinx are open source. But my question is How to inegrate the code of sphinx with OpenOffice’s code? I searched for same but only found how to use sphinx in VB & VC++ applications, but nothing as I wanted. Kindly help me in this regard. Any suggestions are most welcome
Thanking you in anticipation.
Hi puneet,
Can we do the same task of adding words dynamically without using sphinx….building hmms
If anyone can help you are most welcome..its urgent..
Hey,
@Amol, Don’t integrate Sphinx directly with OpenOffice. Create a middle module with FSI implementation that will be main invoker for both sides.
@Renu, Can you explain it more ? I’m not getting your question.
Regards,
Hey Puneet, thanks alot for replying to my post. I did google about FSI implementation and found about Visual F# and trying to get more info on it.(Is it the one you are talking about?)
But I have no knowledge about it and was unable to find how it will be used in our project. Can you please throw some more light on it:)
Hi, I am Junaid and
I want to develop User Independent Automated Speech recognition System for Urdu Language as my BS-Software Eng. final year project
any 1 interested and willing to help me in this please contact
@ http://twitter.com/#!/SydJunaidShah
http://www.facebook.com/sydjunaidshah
or EMail me @ sydjunaidshah@yahoo.com
BEST REGARDS
Jojo
Dear Puneet!!
Thanks for make available all stuff of Sphinx in very good manner. I go through ur website, you have a great interest of ROBOTICS!! thats really good buddy.
I am new user & developer of Sphinx4, so i have some basic problems.
1) I have successfully configure sphinx4 on Fedora14 and also able to run their demos (i.e. HelloWord…etc)
2) Now I try to start prepared my on Isolated Word Recognition[IWR].
3) I have recorded 50 words on my voice in a single wave file.
4) I found one tutorial to build IWR in Linux that I used and prepared the system.
/////////////////////////////////////////////////////////
Training Phase
************
Assume that we have installed SphinxTrain and Sphinx-4 under the directory /home/workshop/speech.
STEP-1
******
Do the following steps in terminal command line
1) Change to the directory ’speech’.
cd speech
2) Create a directory on the name of model which you are going to train.
3) For isolatedmodel speech, let us create directory called ‘isolatedmodel’.
mkdir ‘isolatedmodel’
4) Change to the directory ‘isolatedmodel’
cd isolatedmodel
5) create the directory called ‘wav’ using the command
mkdir wav
copy all of your wav files used for training into this directory.
6) Go back to the ‘isolatedmodel’ directory
7) Create directory named ‘etc’
mkdir ‘etc’.
a) Use the following commands in terminal to create files
gedit isolatedmodel.dic
Then save it to /home/workshop/speech/isolatedmodel/etc
gedit isolatedmodel.phone
Then save it to /home/workshop/speech/isolatedmodel/etc
gedit isolatedmodel.filler
Then save it to /home/workshop/speech/isolatedmodel/etc
gedit isolatedmodel_train.transcription
Then save it to /home/workshop/speech/isolatedmodel/etc
gedit isolatedmodel_train.fileids
Then save it to /home/workshop/speech/isolatedmodel/etc
A) isolatedmodel.dic :- phonetic dictionary
This file contains the vocabulary which is spoken in the speech data and pronunciation i.e. phonetic sequence.
a) Copy all the words from your wordlist into ‘isolatedmodel.dic’ file.
b) Sort the file using the following commands
sort -u isolatedmodel.dic > temp
mv temp isolatedmodel.dic
b) After each word,
press the tab
then give the phonetic sequence i.e. the phones that are used in the pronunciation that word.
Phonetic dictionary structure
**********************
అంకెలౠa M k e l u
అంటే a M t E
B) isolatedmodel.filler :- filler words
Copy below three lines to isolatedmodel.filler
*****************************
SIL
SIL
SIL
C) isolatedmodel.phone: This file contains phones that are considered in building the phonetic dictionary
use the program ‘create-phonelist.pl’ from the workshop-material/isolated-programs to create phone list from your dictionary
a) copy ‘isolatedmodel.dic’ to your workshop-material/isolated-programs directory
b) change to the isolated-programs directory in the command line
use the following command
perl create-phonelist.pl
At the end of phone list, please add the phone ‘SIL’ to phonelist.
copy the ‘isolatedmodel.phone’ file to your ‘isolatedmodel/etc/’ directory.
D) isolatedmodel_train.transcription
This file contains the information about words or sentences that are spoken in speech data and corresponding wav file names.
structure
********
If there is one word or sentence for each wav file
word (correcsponding wav file name)
if there are multiple words in the wav file
word word word (correcsponding wav file name)
Structure
********
అంతఃపà±à°°à°®à± అంతరమౠఅంతరà±à°¯à°¾à°®à°¿ à°…à°•à±à°·à°°à°®à± అమృతమౠఅమà±à°® ఆవౠఇలà±à°²à± ఈగ ఉడà±à°¤ (ramesh)
అంతఃపà±à°°à°®à± అంతరమౠఅంతరà±à°¯à°¾à°®à°¿ à°…à°•à±à°·à°°à°®à± అమృతమౠఅమà±à°® ఆవౠఇలà±à°²à± ఈగ ఉడà±à°¤ (suresh)
అంతఃపà±à°°à°®à± అంతరమౠఅంతరà±à°¯à°¾à°®à°¿ à°…à°•à±à°·à°°à°®à± అమృతమౠఅమà±à°® ఆవౠఇలà±à°²à± ఈగ ఉడà±à°¤ (mahesh)
E ) isolatedmodel_train.fileids
This file contains list of wav files you are using for the training
In the file names, you have to remove the extension .wav
Structure
*******
ramesh
suresh
mahesh
Note: Please check all the above files at the end and remove if there are empy lines in the end. They should not have any empty line in the end.
STEP-2
******
Once you have the above files ready
9) Go to the directory ’sphinxtrain’.
10) Give the following command to create model
perl scripts_pl/setup_tutorial.pl isolatedmodel
This command will copy all necessary files for training into the ‘isolatedmodel’ directory.
11) Go back to the ‘isolatedmodel directory. Copy the wave2feat binary from ‘bin’ to ‘isolatedmodel’ directory
cp ../bin/wave2feat .
12) Run the following command to extract features
./wave2feat -mswav yes -ei wav -di wav -c etc/isolatedmodel_train.fileids -eo mfc -do feat
13) Run the following command to train your acoustic model.
perl scripts_pl/RunAll.pl
Note: If you want to do any modifications to the sphinx configuration, please open the file /etc/sphinx_train.cfg
A) Number of states per HMM can be modified in the line 101
B) Number of Guassian densities can be modified in the line 107
C) Number of senones can be modified in the line 120
Testing Phase
***********
1) Copy acoustic.pl to ’speech’ directory from the directory ‘workshop-material/isolated-programs’
2) Go to the speech directory,
3) Run the perl program,
perl acoustic.pl isolatedmodel isolated
This program will create a new directory called ‘isolated’ in ’speech’ directory.
4) Copy this directory ‘isolated’ to the directory ’sphinx4/models/acoustic’
5) Copy newlm-isolated.pl to ’sphinx4/src/apps/edu/cmu/sphinx/demo’ directory from the directory ‘workshop-material/isolated-programs’
6) Go to the directory ’sphinx4/src/apps/edu/cmu/sphinx/demo’
perl newlm-isolated.pl helloisolated isolated
This program will create the new directory called ‘helloisolated’ in your ’sphinx4/src/apps/edu/cmu/sphinx/demo’ directory
7) Now, we have to create the jsgf grammar file for the isolated speech recognition. Go to the ‘workshop-material/isolated-programs’ directory.
9) Run the perl program in the command line
perl create-grammar.pl
This will create ‘hello.gram’ file. copy it to the ’sphinx4/src/apps/edu/cmu/sphinx/demo/helloisolated/’ directory.
10) Go back to ’sphinx4′ directory
11) Open ‘build.xml’ with gedit. In the build.xml file you have to add, the following lines, in the appropriate sections
in the above section, add the following two lines
in the above section, add the following lines
11) Open ‘demo.xml’ with gedit. In the demo.xml file
In the Following section,
add the following line
compile_sphinx_helloisolated,
After the above section add following lines
12) Now in the terminal command line, go to ’sphinx4′ directory.
13) Run the following command
ant
This will create all necessary jar files in your ‘bin’ and ‘lib’ directories.
14) Now, one can start testing the speech recognition system.
15) In the terminal, go the ’sphinx4′ directory.
use the command,
java -jar -Xms512m bin/HelloIsolated.jar
//////////////////////////////////////////////////////////
5) After following all instruction from tutorial i get jar file when i run this jar file I am getting following error.
/////////////error/////////////////////////////////////////
no args
Exception in thread “main” java.lang.RuntimeException: Allocation of search manager resources failed
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:651)
at edu.cmu.sphinx.decoder.AbstractDecoder.allocate(AbstractDecoder.java:87)
at edu.cmu.sphinx.recognizer.Recognizer.allocate(Recognizer.java:168)
at edu.cmu.sphinx.demo.hellopsd.HELLOPSD.main(HELLOPSD.java:39)
Caused by: java.io.IOException: edu.cmu.sphinx.jsgf.JSGFGrammarParseException
at edu.cmu.sphinx.jsgf.JSGFGrammar.createGrammar(JSGFGrammar.java:302)
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:646)
… 3 more
Caused by: edu.cmu.sphinx.jsgf.JSGFGrammarParseException
at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:132)
at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:241)
at edu.cmu.sphinx.jsgf.JSGFGrammar.loadNamedGrammar(JSGFGrammar.java:694)
at edu.cmu.sphinx.jsgf.JSGFGrammar.commitChanges(JSGFGrammar.java:610)
at edu.cmu.sphinx.jsgf.JSGFGrammar.createGrammar(JSGFGrammar.java:298)
… 6 more
//////////////////////////////////////////////////////////////
can you tell me where I am making mistakes!!!
Thanks Brother !!!!!! I am waiting for ur response
Hey Mahesh,
Thanks buddy. I haven’t really looked at the complete process yet. Nor i would suggest you to do so for only 50 words.
For a quick response, the exception says, there’s some mistake in grammar file OR system is unable to locate the grammar file. double check it and let me know if you still face the same exception.
Regards,
Puneet Kalra
Hello Puneet,
Thanks for reply and given ur time for my post…..yes u a right there was problem in my grammar file. I made some changes and able to run the jar file.
But I more things i have to ask you that In tutorial I post for IWR, It prepared phone based dictionary and grammar file. Which is I come to no very insufficient for data like only 50 word and only single user recorded wav file.
So can u suggest me, how much and how many user data i have to prepared. for developing IWR system. I am thinking to go initial for word level rather phone level. What you say buddy and please provide me any tutorial to make IWR system.
Dear if u don’t mind can i hav ur email id, so we can in frequently touch.
Regards
Mahesh Bhargava
Hey Mahesh,
Great ! Get as much as possible.
Have you tried : http://puneetk.com/expanding-dictionary-of-acoustic-model ?
Get in contact through my Facebook page. Click on “Subscribe” link at the bottom. I’m usually slow by mail or commenting here.
Regards,
Puneet Kalra
hi, this is great.
tnx
hey
how to integrate sphinx4 in j2EE application .
Hey, I went through your tutorial, and am getting an error…
Exception in thread “main” Property exception component:’dictionary’ property:’fillerPath’ – Can’t locate resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/fillerdict
edu.cmu.sphinx.util.props.InternalConfigurationException: Can’t locate resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/fillerdict
Any ideas what I might have done wrong? Pretty sure I did everything you said to in the tutorial…