Hello All,

This is my first video tutorial. This tutorial demonstrates how to make a speech recognizer in java using Sphinx.

Requirements to work according to the tutorial :

1 ) JDK 6 ( J2SE )

2 ) Eclipse SDK ( Im using Eclipse 3.4.0 )

3 ) Sphinx 4.0

4 ) JSAPI ( Included in Sphinx 4.0 )

Tutorial is divided into 3 parts.

Please feel free to post your comments and suggestions on tutorial and help me to improve the quality.

Regards,

98 Responses

  1. Pingback: Richelle Monclova
  2. Hi Puneet bhae

    your tutorial is great.

    i m working on a speech enabled search engine. i will be thankful if you give me some help.

    regard Shumaila

  3. Hi, your tutorial is of great help. I would like to ask some pointers, if it’s okay with you, regarding wav files and indexing. I need to get the time from a wav input. I’m working on it, and I’m sort of stuck. Thanks πŸ™‚

  4. Hi Puneet, My final year project is Home Automation System Using Speech Recognition. Now I am in trouble in speech recognition part. I have some class for testing speech recognition. But they throw me an exception, i.e NullPointerException and says mbrola.base is undefined.

    Now can you help me by giving some idea of this project in details…? Thank You.

  5. hey puneet…

    thanks a lot for ur tutorials…but i hav a question

    I want sphinx to recognize all the discrete words that the user speak..ie the words in the dictionary.. what grammar should i write??? ie without mentioning their token names separately in it.. please do help??

  6. hi kalra i have made a project on media player in java .Now i want to use sphinx for speech recognition as i want to play and stop the media through a speech .I have made a simple recogniser but when i run it give javax.speech.*; class not found error .so, can you give me the procedure for how to use sphinx for speech recognition.

    It is very urgent reply fast.

    Thanks in advance.

  7. Hi puneet i have studied your video you are using eclipse but i am using netbeans which does’nt give the same result ..Anyways i tried to run demo and it runs b’coz it was a jar file but when i make a java file and tried to run it through command prompt it won’t work .

    I am getting an error of Buildfile:build.xml does’nt exist.

    so tell me the steps of packing my java pgm into a jar file so that i can run it with java -Xmx256m -jar bin/HelloWorld.jar.

    Also i am using apache ant to build my sphinx and my pgm.

    please reply fast it’s urgent.

  8. Hello Puneet,

    I am developing a speech recogniser and translater in java. So i am using sphinx4 for the purpose. I am able to run all the demos (thanx to your video tutorial). I am very new in sphinx. I am stuck at how to use dictionary in my application so that i can get access to variety of words. I also need a little help in training. Please reply fast

  9. hi puneet,

    your post is very helpful.. Thanks for ur effort.

    Do u have any idea that how to handle punctuation marks in sphinx grammar??

    Thanks in advance.

  10. Hi puneet,

    I want to use sphinx in an applet.I have tried some demos to familier with sphinx in order to recognize and get the voice to text.but since in applet i don’t know how to access gram file.Can u please help me?thanks a lot!!

  11. hi puneet sir

    wil u plz tell me how to do changes in config.xml file.so we can add few more words to speech recognition system.

  12. please tell me how i put voice recognition in java project?

    i will do a project for autistic and the project have to take the voice response from the patient please help me in this part

    thanks a lot

  13. hi i want to ask how can i implement Helloworld program on the applet. i have tried bt it was not given any response neither result nor error. plz help me i’ll be thankful to you

  14. Good work making this tutorial.

    I was unable to understand the file required for my own implementation. It really helped.

    You could have saved some time by using voice input instead of typing it.

    Thanks, πŸ™‚

    Hassan Farid

  15. Hi….

    my name is Sangamesh. Now i am studying in final year B.E(Information Technology).For academic project in college I am doing one project which is based on sphinx4. My project is to develop application which will recognize our regional language “Kannada”. i am not getting that how to create new acoustic model for kannada language… so please help me.

  16. Pingback: paula alexander
  17. Hello. Just followed the tut and it works great. But i’m new to java and a i have a question for you. If i would say the word “beer” i want the program to give me a specific response for this word. Or if i say “Open browser” the program to open firefox. How can this be done? Thanks!

  18. ok, managed to make the modification, so you can delete the first request πŸ™‚ But now i have another problem. I’ve exported my project as .jar, and when i try to run it from command prompt i get this:

    Exception in thread “main” java.lang.NoClassDefFoundError: edu/cmu/sphinx/util/p

    rops/ConfigurationManager

    at edu.cmu.sphinx.demo.helloworld.HelloWorld.main(HelloWorld.java:34)

    Caused by: java.lang.ClassNotFoundException: edu.cmu.sphinx.util.props.Configura

    tionManager

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    … 1 more

  19. hi,

    how to create a jar file of the speech recognizing program

    i want the jar file that can be executed that takes voice input and gives a text as output

    please respond fast.i have very less time to submit my project…thanks in advance

  20. Can we implement this in android ? I do not want to use the android Speech api for this because it is google dependent I can not customize my grammar.

  21. Hi Puneet, i’m 3th student, i’m doing my project about browse web by voice and used leangue is VietNamese, so How can i do that, because sphinx use English

  22. hello frd..!

    i gets some exception error like this during running the programe

    plzzz help me to solve this…! πŸ™

    Exception in thread “main” java.lang.NoSuchFieldError: engineListeners

    at com.sun.speech.engine.recognition.BaseRecognizer.fireRecognizerSuspended(BaseRecognizer.java:977)

    at com.sun.speech.engine.recognition.BaseRecognizer.dispatchSpeechEvent(BaseRecognizer.java:1273)

    at com.sun.speech.engine.SpeechEventUtilities.postSpeechEvent(SpeechEventUtilities.java:201)

    at com.sun.speech.engine.SpeechEventUtilities.postSpeechEvent(SpeechEventUtilities.java:132)

    at com.sun.speech.engine.recognition.BaseRecognizer.postRecognizerSuspended(BaseRecognizer.java:965)

    at com.sun.speech.engine.recognition.BaseRecognizer.commitChanges(BaseRecognizer.java:375)

    at edu.cmu.sphinx.jsapi.JSGFGrammar.createGrammar(JSGFGrammar.java:288)

    at edu.cmu.sphinx.linguist.language.grammar.Grammar.allocate(Grammar.java:123)

    at edu.cmu.sphinx.linguist.flat.FlatLinguist.allocate(FlatLinguist.java:225)

    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:576)

    at edu.cmu.sphinx.decoder.Decoder.allocate(Decoder.java:109)

    at edu.cmu.sphinx.recognizer.Recognizer.allocate(Recognizer.java:182)

    at demo.sphinx.helloworld.HelloWorld.main(HelloWorld.java:42)

    Java Result: 1

  23. Hello

    I am working on voice to text conversion for recorded calls on my website, calls will be in “UK accent”, I have mp3 files of those calls. I want calls to be kept in text document form.

    Please share your knowledge about this.

    I am using Linux OS, Please let me know if I can achieve my task using your software.

    Email for contact : sujitb@techhighway.co.in

    Thank you for your help

  24. i am trying the latticedemo sphinx but iam getting the error the code is

    package edu.cmu.sphinx.demo.lattice;

    import edu.cmu.sphinx.frontend.util.AudioFileDataSource;

    import edu.cmu.sphinx.recognizer.Recognizer;

    import edu.cmu.sphinx.result.Lattice;

    import edu.cmu.sphinx.result.LatticeOptimizer;

    import edu.cmu.sphinx.result.Result;

    import edu.cmu.sphinx.util.props.ConfigurationManager;

    import java.io.File;

    import java.io.IOException;

    import java.io.PrintStream;

    import java.net.URI;

    import java.net.URL;

    import javax.sound.sampled.UnsupportedAudioFileException;

    public class LatticeDemo

    {

    public static void main(String[] args)

    throws IOException, UnsupportedAudioFileException

    {

    URL audioURL;

    if (args.length > 0) {

    audioURL = new File(args[0]).toURI().toURL();

    } else {

    audioURL = LatticeDemo.class.getResource(“10001-90210-01803.wav”);

    }

    URL url;

    if (args.length > 1) {

    url = new File(args[1]).toURI().toURL();

    } else {

    url = LatticeDemo.class.getResource(“config.xml”);

    }

    System.out.println(“Loading…”);

    ConfigurationManager cm = new ConfigurationManager(url);

    Recognizer recognizer = (Recognizer)cm.lookup(“recognizer”);

    recognizer.allocate();

    AudioFileDataSource dataSource = (AudioFileDataSource)cm.lookup(“audioFileDataSource”);

    dataSource.setAudioFile(audioURL, null);

    boolean done = false;

    while (!done)

    {

    Result result = recognizer.recognize();

    if (result != null)

    {

    Lattice lattice = new Lattice( result);

    LatticeOptimizer optimizer = new LatticeOptimizer(lattice);

    optimizer.optimize();

    lattice.dumpAllPaths();

    String resultText = result.getBestResultNoFiller();

    System.out.println(“I heard: ” + resultText + “\n”);

    }

    else

    {

    done = true;

    }

    }

    }

    }

    my error is:

    Exception in thread “main” java.lang.Error: Unresolved compilation problem:

    The constructor Lattice(Result) is undefined

    at edu.cmu.sphinx.demo.lattice.LatticeDemo.main(LatticeDemo.java:51)

    hepl me to solve the error

    1. Hi Puneet

      I need your help. I want to do a research on speech recognition on Kannada language. Please help me. I am unable to use ur tutorial properly. Please kindly help me

      Regards,

      Geeta

  25. Hi,

    When I run HelloWorld program the output is not as expected. For Example if I say Hello will it says Good morning. Why is this problem and how can I solve it?

  26. Dear Sir !

    I have a project on voice recognition system.i am new to this system & doesn’t know how to start.Can you please please guide me how can I start from scratch on Java or either MATLAB will be much better.Kindly guide me .Reply me ASAP.

    I will be waiting:)

  27. Dear Sir !

    I have a project on voice recognition system & doesn’t know how to start.Can you please please guide me how can I start from scratch on Java or either MATLAB will be much better.Kindly guide me .Reply me ASAP.

    I will be waiting:)

  28. Bro your explanation is excellent but I need to add extra words both manually and dynamically to the grammer file.So please help me to do that.

Leave a Reply

Your email address will not be published. Required fields are marked *


Notice: Use of undefined constant STOPSPAM_PLUGIN_VERSION - assumed 'STOPSPAM_PLUGIN_VERSION' in /home/webpilla/puneetk.com/wp-content/plugins/stop-spam/stop-spam.php on line 36

Notice: Use of undefined constant STOPSPAM_PLUGIN_VERSION - assumed 'STOPSPAM_PLUGIN_VERSION' in /home/webpilla/puneetk.com/wp-content/plugins/stop-spam/stop-spam.php on line 40