Friday, February 18, 2011

App Inventor sample project: Voice to Text and vice-versa

I'm back with another App Inventor tutorial for you. This time around, I have a simple tutorial that demonstrates an app that is able to convert your voice to text and, in turn, that text back to voice. Google does all of the heavy lifting in regards to converting voice and text, and thankfully makes it very easy to tap into those resources.

Let's get started...

1. Click on My Projects, then create a new project. I called mine VoiceApp.

2. You will now see the layout screen with Palette, Viewer, Components, Media and Properties boxes. Adding components is easy by dragging objects from the Palette box onto the Viewer.

3. Now drag a Button from the left column under Basic onto the palette. Select the button in the Components column and click Rename to change the name to VoiceToTextButton. Then, in the Properties column, set the Text to "Voice to Text."

4. Next, drag in a Label and place below the VoiceToTextButton. Rename the label to ResultLabel and set the Text field to "".

5. Drag in another Button and place below ResultLabel. Rename to TextToVoiceButton and set Text field to "Text to voice."

6. Now, expand the Other Stuff tab in the left column and drag two final components onto the palette: SpeechRecognizer and TextToSpeech. NOTE: These are non-visible components and so will appear below the palette.

Your screen should now look like this:


7. Now connect your Android phone via usb. On your phone, go to Settings-->Applications-->Development. Enable USB debugging and Stay awake.

8. On the layout screen click the button to Open the Blocks Editor. This will open a Java applet that contains all of the logic blocks/action handlers and interfaces with your phone.

9. In the Blocks Editor, create the following code:

We need to handle the Voice to text button click event first. In this, we simply tell the SpeechRecognizer1 to start listening. The BeforeGettingText function clears our label so the words spoken can be displayed there. The AfterGettingText function sets our label to the words spoken.

10. To go the other way--text to voice--we handle the click event of the other button. TextToSpeech1.Speak has an output parameter that we set to our label.text field.

In order for this component to work, the device must have the TTS Extended Service app by Eyes-Free Project installed. You can download this from http://code.google.com/p/eyes-free/downloads/list

So there's the code (layout and blocks) required for building a simple voice-to-text and text-to-voice application.

Download this application onto your phone by scanning this code:

47 comments:

  1. Hi my friend, great tutorials I must say!
    I'm working on a "co workers phonebook". I'm sick of filling my personal phonebook with 100 of CO's and I've been trying to make my "CO phonebook" using the list pickers but the only thing I can do is text, I want to have the list + the phonecall function. Cant sort it out, I'd be greatful if you had any tip for me or even better, show me some blocks in the block editor 8)

    Best regards Nicklas

    ReplyDelete
  2. Hi Nicklas,

    You may find this tutorial helpful for making phone calls. http://appinventor.googlelabs.com/learn/tutorials/piccall/piccall.html

    - tk

    ReplyDelete
  3. i want to convert speech to text... so i done but dont work... pls help me...and list the code....

    ReplyDelete
  4. how can i do a project like put the word hello in press a translate button and changes to another word.

    ReplyDelete
  5. Sorry for the silly question but how do you get the Text block with just Text and no drop down? Thanks tons

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. In many ways Voice Actions for Android is very similar to the Vlingo for Android product—just by pushing a widget button on the home screen you can speak to your Android phone and have Voice Actions turn your words into actions. Just like Vlingo you can speak to send a text message or an email, navigate to a business location, search the web, and much more. The Voice Actions business dialing feature is very similar to Vlingo’s SuperDialer—you just say “call ” such as “call Blue Ribbon Barbecue” and Voice Actions dials the business for you. It even goes farther in some areas—my favorite is setting the alarm clock on the phone just by speaking “Set alarm for 8 am.”

    ReplyDelete
  8. hi guys!my name is mahmoud and am from africa, i need help on my project and its important. can somebody please contact me via my mail for mentorship. thanks in advance.
    mahmoud.
    email: mahmoudgbessay@gmail.com

    ReplyDelete
  9. Hi,
    Is it possible to create Text/String to Sound?
    The text is base64 format of an encrypted text or string.

    and vice versa from sound to encrypted string which then will be passed to a function to decrypt the text/string?

    Thanks.

    ReplyDelete
  10. Congratulations guys, quality information you have given!!!..Its really useful blog. Thanks for sharing this useful information
    |Best Android Training in Velachery | android development course fees in chennai

    ReplyDelete
  11. Thanks! This was extremely helpful! I wanted to share helpful site for voice recognition: convert voice recording to text. Hope this helps someone!

    ReplyDelete
  12. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Click here:
    angularjs training in rajajinagar
    Click here:
    angularjs training in marathahalli

    ReplyDelete
  13. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Click here:
    angularjs training in sholinganallur
    Click here:
    angularjs training in btm

    ReplyDelete
  14. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Blueprism training in Chennai

    Blueprism training in Bangalore

    Blueprism training in Pune

    Blueprism online training

    ReplyDelete
  15. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Blueprism training in Chennai

    Blueprism training in Bangalore

    Blueprism training in Pune

    Blueprism online training

    ReplyDelete
  16. Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging

    DevOps online Training|DevOps Training in USA

    ReplyDelete
  17. Outstanding blog post, I have marked your site so ideally I’ll see much more on this subject in the foreseeable future.
    java training in chennai | java training in bangalore

    java online training | java training in pune

    ReplyDelete
  18. This is a terrific article, and that I would really like additional info if you have got any. I’m fascinated with this subject and your post has been one among the simplest I actually have read.
    Data Science Training in Chennai | Data Science course in anna nagar
    Data Science course in chennai | Data science course in Bangalore
    Data Science course in marathahalli | Data Science course in btm

    ReplyDelete

  19. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.


    AWS Training in BTM Layout |Best AWS Training in BTM Layout

    AWS Training in Marathahalli | Best AWS Training in Marathahalli


    ReplyDelete

  20. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.


    AWS Training in BTM Layout |Best AWS Training in BTM Layout

    AWS Training in Marathahalli | Best AWS Training in Marathahalli


    ReplyDelete
  21. Thanks for information i also interested in learning for your blog.
    Speech To Text


    ReplyDelete
  22. We Offer Professional Online Transcription Services
    At Very Affordable Rates.Powered By Native Transcribers, We Deliver Great Quality.Chat With Us Now!.

    ReplyDelete
  23. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    blue prism Training in Electronic City

    ReplyDelete
  24. I have found that this site is very informative, interesting and very well written. keep up the nice high quality writing. Download speech recognition

    ReplyDelete
  25. On my website you'll see similar texts, write what you think. 60 inches in feet

    ReplyDelete
  26. This site certainly has all the info I wanted concerning this subject and didn’t know who to ask.

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. This is interesting blog keep on doing...

    https://www.acte.in/angular-js-training-in-chennai
    https://www.acte.in/angular-js-training-in-annanagar
    https://www.acte.in/angular-js-training-in-omr
    https://www.acte.in/angular-js-training-in-porur
    https://www.acte.in/angular-js-training-in-tambaram
    https://www.acte.in/angular-js-training-in-velachery

    ReplyDelete
  29. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all querie.thanks
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  30. very interesting to read this article. I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.


    Angular js Training in Chennai

    Angular js Training in Velachery

    Angular js Training in Tambaram

    Angular js Training in Porur

    Angular js Training in Omr

    Angular js Training in Annanagar



    ReplyDelete
  31. VNC Connect Enterprise 6.7.1 Full Crack With Keygen. [Latest] \/\/FREE\\\\. Fujistu Coccokat Web Monitor with Crack Latest By Pengifer Box [Latest] Fujistu.Vnc Server Free License

    ReplyDelete