Speech recognizer sample code

*************************************************************************
Dear Reader,

All the post in shakthydoss.wordpress.com have been moved to shakthydoss.com

shakthydoss.wordpress.com is no longer functioning. To get the latest updates and follow up your comments please come to shakthydoss.com and get subscribed.

Find Speech recognizer sample code @ http://shakthydoss.com/speech-recognizer-sample-code/

Thank you
shakthydoss

**************************************************************************

Advertisements

14 Responses to “Speech recognizer sample code”

  1. andy Says:

    hwo do u compile the above program using cmu spinx?

  2. shakthydoss Says:

    It is same as compiling any Java program.
    You must provide proper heap memory size at the time of execution also make sure that config file and grammar files are in correct path.

    • techstu123 Says:

      ok i figured what i was doin wrong,lot many things apparently.
      anyway,now i’m getting this error:

      Exception in thread “main” java.lang.NullPointerException
      at edu.cmu.sphinx.util.props.SaxLoader.load(SaxLoader.java:64)
      at edu.cmu.sphinx.util.props.ConfigurationManager.loader(ConfigurationManager.java:383)
      at edu.cmu.sphinx.util.props.ConfigurationManager.(ConfigurationManager.java:115)
      at HelloDigits.HelloDigits.main(HelloDigits.java:36)

      It gives this error where i get the recognizer.something wrong the the config file i guess.it compiles fine though.

      • shakthydoss Says:

        I Dont know what the changes you have made exactly.
        Any How current exception may come due grammar file configuration.

        In the Grammar file(XML File) , go to The Grammar configuration section
        then check this

  3. techstu123 Says:

    I tried this out,i didn’t include the package statement n i saved the files to my regular directory called Project.IT fives me a NoClassDefFoundError.
    Speech Recognition is a major part of my project.Please help.

  4. shakthydoss Says:

    In the Grammar file(XML File) , go to The Grammar configuration section
    then check this
    property name=”grammarLocation”

    value=”resource:/edu.cmu.sphinx.demo.hellodigits.HelloDigits!/edu/cmu/sphinx/demo/hellodigits/”

    • techstu123 Says:

      ya its right,no problem there.

      • techstu123 Says:

        Exception in thread “main” java.lang.NullPointerException
        at edu.cmu.sphinx.util.props.SaxLoader.load(SaxLoader.java:64)
        at edu.cmu.sphinx.util.props.ConfigurationManager.loader(ConfigurationManager.java:383)
        at edu.cmu.sphinx.util.props.ConfigurationManager.(ConfigurationManager.java:115)
        at hellodigits.HelloDigits.main(HelloDigits.java:36)

      • techstu123 Says:

        found out the prob.the placement of config.xml was outside the package!
        now i am getting this error :

        Exception in thread “main” java.lang.NullPointerException
        at hellodigits.HelloDigits.main(HelloDigits.java:47)

        th eline is:microphone.startRecording();could be wrong?

        my mike is connected and working.What

      • shakthydoss Says:

        To techstu123
        Take a look of this https://shakthydoss.wordpress.com/2011/06/08/speech-recognizer-execution/

  5. Mustafa adel Says:

    I have error on recognizer.allocate(); >> null please help as I get disappointed with the error ?? mustafa.adel.elnagar@ieee.org

    • shakthydossdoss Says:

      To Mustafa adel
      Ok this may be help full for you https://shakthydoss.wordpress.com/2011/06/08/speech-recognizer-execution/

  6. Ryan Kareem Says:

    Hi, I have run the 2000 project into my netbeans and it worked fine. However, I am not getting any clue of adding new file in the dictionary. I followed the following process,

    PART ONE
    Step 1 : Create a txt file “words.txt”, Write all the names of cities and states in it and save.
    Step 2 : Open this link : http://www.speech.cs.cmu.edu/tools/lmtool.html
    Step 3 : On that page, go to “Sentence corpus file:” section, Browse to “words.txt” file and click “Compile Knowledge Base”.
    Step 4 : On next page, Click on “Dictionary” link and save that .DIC file.

    PART TWO
    Step 1 : Extract WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar file.
    Step 2 : Go to edu\cmu\sphinx\model\acoustic\WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz\dict folder.
    Step 3 : Open “cmudict.0.6d” file in that folder.
    Step 4 : Copy data from .DIC file, you have downloaded in PART ONE, paste it in “cmudict.0.6d” file and save.
    Step 5 : Zip the extracted hierarchy back as it was and Zip file named should be same as JAR file.

    Now, remove “WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar” file from Project’s CLASSPATH and add “WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.zip” instead of it.

    (got these steps from this link http://puneetk.com/expanding-dictionary-of-acoustic-model)

    but after following the process, I got this exception message,

    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:292)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.setupAcousticModel(FlatLinguist.java:207)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:171)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:430)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:280)
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchManager.java:145)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:430)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:280)
    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:430)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:280)
    at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:78)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:430)
    at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163)
    at edu.cmu.sphinx.demo.helloworld.HelloWorld.main(HelloWorld.java:36)
    Java Result: 1

    Could you please help me to add more words in the project you posted (2000)? It would be great to have a video tutorial on the step of adding a words. I searched and found one video about this on youtube but it didnot work as well.

    Thanks in advanced

    • shakthydoss Says:

      I will try and let you know what it is going wrong.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: