"I Think, I Conceptualize, I Analyze, I Design, and I Create." ~ Puneet Kalra

Cognitive Robotics Research Centre Of University Of Wales, Newport Puneet Kalra

Home Studies Research Projects Tutorials Portfolio

Puneet Kalra - www.puneetk.com - Socializing Robots

Speech Recognizer In Java (Tutorial)

September 14th, 2009 by Puneet Kalra Leave a reply »

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,

78 Responses

  1. Shumaila says:

    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

  2. Paula Mendoza says:

    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 :)

  3. Bitan says:

    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.

  4. Bitan says:

    I saw your tutorial.. Very helpful one for me.. Great job. But Puneet, What will be the structure of helloworld.config.xml file?

  5. Reshma says:

    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. chetan says:

    buddy ,,, u rock!!!

  7. Tajinderpal singh says:

    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.

  8. Tajinderpal singh says:

    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.

  9. Rajendraprasad says:

    how to make my recognizer to recognize complete english language instead of giving grammar for it. is it possible.

  10. Ajitesh says:

    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

  11. karthi K says:

    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.

  12. chathuri says:

    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!!

  13. Rahul says:

    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.

  14. ema says:

    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

  15. Shumaila says:

    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

  16. Shumaila says:

    plz rply fast

  17. Hassan Farid says:

    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

  18. Sangamesh Naikar says:

    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.

  19. florin says:

    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!

  20. florin says:

    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

Leave a Reply

Please note : I will help you only if you will show some efforts! Don't expect replies to simple queries, You can easily find answers for them through searching.

I'm a student and I work as well. So i might reply late here. If you have something important to discuss Or stuck somewhere in your project. Please post on my Facebook page for a quick response.