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.


98 Responses

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



  2. 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. 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. 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…..


  5. Hello Liliane,


    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.


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


      1. 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……….


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


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


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

  9. 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 πŸ™‚

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

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

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

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

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

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

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

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

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


  19. Hello,

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

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

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

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

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

  24. Hello!

    I made a grammar rule called and put some words in it (Actually a LOT of words). Then i made a = rule… if i have only a few words, its ok. My application runs and recognizes them. But if I have lots of words i get this RuntimeError :” Allocation of search manager resources failed”.. What is it?


  25. 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….

  26. 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….

  27. @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.


    Puneet Kalra

  28. 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?

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


    Puneet Kalra

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

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

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

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

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

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

Leave a Reply

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