"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,

Advertisement

57 Responses

  1. Sura says:

    Hi Mr. Kalra,

    your video tutorials for Speech Recognizer In Java are extremely useful. trouble is the quality of the video is poor, no offend, which makes it hard to follow your steps. Could you post a higher video quality ? that would really helps.

    cheers,

    sura

  2. Puneet Kalra says:

    Hello Sura,

    Thanks for comment.
    Yes, sure. I already have the high quality video. But its larger in size ( About 300 MBs ). So I will be uploading it and will post links here.

    Regards :)

  3. andres says:

    very nice tutorial my friend, thank for that, just the same comment… the quality of the video, but is a very nice tutorial… thanks again.

    Andrés from Chile

  4. Puneet Kalra says:

    Hello Andres,

    Thanks for comment !

    I have uploaded the high quality video.

    you can get it from here .
    http://puneetk.com/sphinx-4-0-video-tutorial-high-quality

    Regards,

  5. liliane says:

    Hi Kalra,

    thank you so much for this tutorial. it was really helpful thanks again……..
    I need to use SphinxTrain in sphinx4 I want to do the training for sphinx4 to be able to recognize some words. if you have done it before i will be very happy if you can help me…..

    thanks

  6. Puneet Kalra says:

    Hello Liliane,

    Thankyou.

    SphinxTrain, Well I would like to know the exact reason first. Do you want to add few more words to dictionary ? Or we can say, Do you want Sphinx to recognize few more words not available in default acoustic models provided by CMU ?

    If this is the reason and words are only a few, then I would suggest you Not to use SphinxTrain as its a big process.

    I have another way to do it. If I’m correct on the reason. Let me know, I will tell you how to do it.

    Regards.

    • liliane says:

      hi Kalra
      thank you for your prompt reply…..
      I want to create an Automated Speech Recognition System (ASR) based on the open source sphinx-4, so I want to investigate the changes that must be made to the acoustic model to be adapted for my application.
      but I can start by adding just few more words in the acoustic model to see how it’s work. I will be grateful if you can help to do it…..so please could you tell me your way to do it smart man……..
      after that we will see if you can help me for sphinxTrain or any other tools to add a big corpus to the acoustic model of the sphinx-4…

      thank you so much.
      Regards

      • liliane says:

        hello,

        I forget to tell that some person they use HTK and ATK to create the speech recognizer.I’am stuck and I didn’t find any tutorial with all steps , i’am usin windows vista and i notice that most of them are using Linux as OS ………..I’m depressing :(

        thanks in advanced for your help……….

        Regards

  7. Puneet Kalra says:

    Hello again,

    Alright. I will be posting my tutorial publicly in few time. So it will be available for others too. This is just a small but important part of developing an ASR.

    Developing ASR, you need to consider on configuration part of Sphinx. Not how you write the config file. Important thing is, Which components and properties you should use, Like, absolute and relative BeamWidth, languageWeight, searchGrams, Linguist, languageModel etc.

    To understand these things, you need to learn algos and background working of Recognition. For that, i suggest you to read any good book on ASR.

    Even, im not expert on ASR, I’m just another student of ASR and i hope together we both can gain more better knowledge and create a better system.

    Again, I will be posting tutorial soon.

    Regards,

  8. liliane says:

    hello Kalra,

    Great smart man, it’s a good news so waiting for your interesting tutorial as usual………

    I have a background in ASR but I didn’t practice it because I’m try to learn alone and i didn’t take any courses ………..
    thanks again

    Regards

  9. Puneet Kalra says:

    Hello again,

    Heres the tutorial : http://puneetk.com/expanding-dictionary-of-acoustic-model

    We will continue talk there :)

    Regards,

  10. Rehman says:

    Puneet Boss you post was very helpful in undestaning ASR in sphinx. Doing a great job looking forward for more update in futre.

    Have Good Day
    Happy Holi.

  11. Hello really wonderful website!! Man .. I will take the rss feeds

  12. Rukmal Fernando says:

    hey this is a cool tutorial.
    have you used freetts? i have been trying to follow the freetts voice recognition tutorials but have fail cos i get a null point exception.
    im unable to use sphnix becos im tryin to integrate it to asterisk which requires 8000kHz samplin rate.
    and one last question.
    can you have a grammer that wil only recognize a specific few names such as 10 cities? f so can you please show an example of grammer that will do the above thing.
    thnx in advance.keep up the good wrk
    you rock :)

  13. Nasir Hussain says:

    Hello Puneet Bhai….Your website is Awesome…. Can u Show how to Use Accuracy tracker..:D

  14. murthy says:

    Sir,
    I’m doing medical transcription and I’m new to java. How can i use sphinx4 in transcribing wave file into text. Please send me early reply.

  15. Puneet Kalra says:

    Hello murthy,

    There’s a demo provided on CMUSphinx’s site.

    Give it a try ! If you are unable to make it work. I’m always available here :)

    Best of luck !

  16. murthy says:

    I’m doing medical transcription and I’m new to java. How can I use sphinx4 in transcribing wave file into text.
    I went through video tutorials. But I am unable to do everything.
    Please help me how to build sphinsx4 and add a wave file to convert into text. I will be grateful, if you could.

  17. vinu says:

    Thank u very much..am doing a project..which hang up due to speeh recognisation..thank u very very much

  18. vinu says:

    i have some doubts on configuration file

  19. vinu says:

    ie,if am writing a config file..which all properties have to be set..pls reply soon..tomorrow is my submission..pls tell me..i have to make it up

  20. vinu says:

    I got it rt anyway..thank u ..

  21. speech recognizer in Java-sounds great..
    videos are very helpful
    thank you for videos
    hope u will bring more
    such things

  22. Puneet Kalra says:

    Hey vinu,

    Sorry for late reply. And I’m really glad that you made it on your own :)

    Regards,

  23. ramana says:

    Sir,
    How can I change transcriber configuration for wave file transcription?

  24. Khanh says:

    Hello Kalra,
    i just wonder which language Sphinx supports.
    U said that you read a good book, so can u tell me that book’s name.
    Can I use Sphinx to recognize Vietnamesse? I come from Viet Nam.

  25. Puneet Kalra says:

    Hello Khanh,

    Sphinx supports all languages as long as you have acoustic model for that language. Search on web if you can get any Vietnamese acoustic model.

    You know, I have been to Vietnam once, I was living in Cambodia before.

    Best of luck!

  26. Khanh says:

    I’m realy not clear about acoustic model.
    Could u give me few instructions to build an small app with a small vocab, something like what i need to do firt, and then … I just want my computer hears some simple sentences.

  27. Khanh says:

    Sphinx supports all languages. How lucky I am! Maybe I could build a good speech recognition engine for my language, in far future!

  28. badr says:

    hi,thank a lot for this tuto ,it’s help me .
    i want to creat an application that detecte some french
    word ,if you can help me plz
    thank you

  29. yuvam jain says:

    heelo puneet sir ,
    i am trying to develop a jaba based simple misic file player which can be controlled by voice of its user . Means it can perform stop/paly on commands by user voice . Means it need speech recognition . Please help me sir, i am facing some problem in deevelopment of it .
    Please guide me .
    yuvamjain@yahoo.co.in

  30. pavan says:

    Hello,
    i want to convert speech to text for independent users can u suggest me a simple way of doing it using java

  31. shashank says:

    helllo sir,
    I am a fresher to java and troubled in downloading the sphinx4 from your specified link can u please help me in downloading and installing that

  32. shashank says:

    helllo sir,
    I am a fresher to java and troubled in downloading the sphinx4 from your specified link will u please help me in downloading and installing that

  33. shashank says:

    hello sir,
    I m fresher to java and dont know how to build sphinx4 from your specified link please help me

  34. shashank says:

    sorry for multiple comments since ther occured some sort of error while commenting and the comment was not visible to me may be due to broken internet link please consider

  35. shashank says:

    I got it no need to reply

  36. Hellow Sir,
    I could run the Hellow World example …

    I am making a WEB Browser for the Blind People, Iam implementing speech recognition system to get the input from user, can u plz help me .. in implementing speech recognition by using sphinx4
    thanking you

  37. Abhishek says:

    Hello Sir, i want to make a speech recognzer in j2me, can u help me in doing that?? what all jars etc are required and how to configure them? please reply soon… also tell me how can i catch you in facebook….

  38. Puneet Kalra says:

    @Firoz, I would suggest you to post the problem instead of asking for help directly.

    @Abhishek, Do little research on it. I will only help if you will show some efforts :)

    Click on “Subscribe” link at bottom of my website for my Facebook page.

    Regards,
    Puneet Kalra

  39. Dishant says:

    In your second & third video….can you please tell me how you have setup VM variables and arguments? The variables were hard to get because of poor video graphics.
    Please reply as soon as possible, i have a project on this.
    Can you please write a .gram file which can recognize any word in the output?

  40. Puneet Kalra says:

    Hello Dishant,

    All you have to do is, change the java heap size to 256MB, for that you can use “-Xmx256m” or “-Xms256m”, something like

    java -Xmx256m AppStarter

    Regards,
    Puneet Kalra

  41. maith says:

    we are working on a speech translator.we are done with two modules.for synthesis we have used freetts. In the recognition part we have saved all the required classes in our jdk, we get a NullPointerException for the line where we allocate recognizer. is there any other tool like freetts which we can be using for recognition.

  42. Indah says:

    Nice tutorial.. really helpfull.
    But I want to know whether Sphinx can be run in android? Because im developing tools that need voice recognition in android.

  43. Ab says:

    Hello Sir,
    I am using Sphinx to build a web browser in which it take input from user voice .
    But problem is that it is taking the first word written in grammar file every time any quick reply will be appreciated

  44. Ida says:

    Hi puneet,
    Thanks for the tutorial. But I want to know whether sphinx can be use in android? Im developing app that need voice recognize. Thanks

  45. florentio says:

    Very awesome your tutorial, me i want to develop an application or software using only voice to work i’ve done some demo using your tutorials but my problem is about prononcuation of word sometime the program didn’t work cause french prononcuation is different of english’s pronounciation. I’m waiting for your help

  46. ramesh says:

    Very nice tutorial.. is it possible to develop a other lang recognition using it like hindi,telugu,tamil….

    if it is so,How? or else sphinx only supported for english..

  47. Puneet Kalra says:

    Hello Florentio and Ramesh,

    http://puneetk.com/expanding-dictionary-of-acoustic-model
    ^ Thats what you need :)

    Regards,
    Puneet Kalra

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

  49. 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

  50. 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.

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.