Merapi AIR/Java Speech Recognition and Voice Control

While I have been playing around with Merapi to add voice recognition for the talking head, I created a little Merapi application that allows me to move a target on the screen by saying the voice commands LEFT, RIGHT, MIDDLE.

I have seen Rich Tretola’s blog Everything Flex on text to speech through Merapi and thought it would make sense to do it the other way around. In other words, voice recognition and voice control.

This is fairly simple to achieve. I decided to use the Sphinx 4 Speech Recognizer which is an open source java project by Carnegie Mellon University and others.

I then wrote a client for that framework, added the merapi jar files and broadcast a merapi message whenever the Sphinx Client detected speech.

You can download the full source code by clicking here.


16 comments so far

  1. Adam Flater on

    Really cool stuff.. would you considering open sourcing this example for the merapi-examples repo?


  2. javadz on

    Would love to šŸ™‚

  3. Rich Tretola on

    Awesome job. I hope to see it in the repo as well.

  4. javadz on

    Thanks šŸ˜‰

  5. Tyrone Neill on

    Very interesting, been looking at building a RTMP player via voice recognition with multi-touch (multi way communication), this is mighty helpful.



  6. boku on

    I have download youre codes, but when i run the SpeechRecognitionRunner, the error is happend(Exception in thread “main” java.lang.OutOfMemoryError: Java heap space)
    at com.merapi.example.speechrecognition.SphinxClient.init(

    can you help me?

    • javadz on

      Assuming that you are running it in eclipse then perhaps you may need to increase the java memory allocation?

  7. Arachchi`s on

    AWESOME !!!! Work !!!

    Dear creator,
    I need a help, I try to config, but I failed, If you can Upload a video tutorial, pleeeeZ šŸ™‚ How to config And How to run this project.

    I`m Arachchi`s
    Thank U….

  8. Ventoline on

    Finally got it working, it took me a whila since i am not a developoer i had to cover some grounds, I noticed you are using Sphinx in this example but the merapi-examples repository one uses freett, what is the difference in between both?

    Thank again for the work, it s fantastic

    • javadz on

      I am using Sphinx to recognise to recognise your speech and turn it into text, whereas freetts is being used to turn text into speech.

  9. lexx on

    Any idea how to make it run in a web application?

    • javadz on

      Should be relatively straight forward i imagine – you just need to capture the microphone input and pass it to the server where Sphinx would be running. I would look at projects like Red 5 – ( or Adobe Media Server for that part. Obviously for that you would’t use Merapi but the principles are broadly similar.

  10. wendi on

    Is it possible to run the files in flex builder? After I import the java class-file, the flash builder indicates me that I am missing many jar files. Is it because I am using flash builder to build it?
    Many thanks

  11. wendi on

    Sorry please just ignore the above question. I have successfully built the project. However, the correct recognition rate is very poor. Do you have any idea why this happen? We are using the flex SDK 3.6 to compile the project. Many thanks for you help.

    • javadz on

      The speech recognition is provided by the sphinx libraries. If you are looking to improve the recognition you could take a look at that project or swap out another text to speech library from a commercial provider. You may notice however that I also have a project on this blog where I have created an augmented reality head that integrates with the Android speech recognition service. I found this to be really pretty accurate and far better than what you get from sphinx out of the box. You do need to target android though …

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: