Speech recognition tutorial

Timmeh Dec 29, 2013

  1. Timmeh

    Timmeh Trve Kvlt
    0/47

    Joined:
    Jan 18, 2013
    Messages:
    468
    Likes Received:
    155
    Trophy Points:
    25
    Gender:
    Male
    Occupation:
    Drummer
    Location:
    Michigan
    Console:
    Xbox
    Speech Recognition Tutorial

    [SIZE=small]Their are an uncountable amount of uses for speech recognition. Today's computers all have speech recognition built in. With speech recognition I can make my program much more user friendly and more efficient in numerous ways. Making your own word processor for your family or even as a side job? Why not add speech recognition as a main feature. Not only does it add value to your windows applications, it will add sophistication. In this tutorial we will cover the basics of getting setup.[/SIZE]

    [SIZE=small]Warning - This tutorial is not recommended for inexperienced C# programmers. This tutorial will leave small details out that experienced C# programmers will already know.[/SIZE]

    [SIZE=medium]Project Setup[/SIZE]

    [SIZE=small]Lets begin by creating a new Windows Forms Application. Now over in our projects references, lets add a new .NetSystem.Speech library. After this, add two buttons and one rich text box to your form. Name the buttons as follows on the image below.[/SIZE]

    [​IMG]

    [SIZE=medium]Speech Engine Setup[/SIZE]
    Double click the main form. This will create a Form_Load function and bring us to the code window. First thing is to declare our System.Speech and System.Threading references to the Form1 class.

    At the beginning of our Form1 class. Lets declare a few classes.

    SpeechRecognitionEngine - Speech engine that translates human speech to a digital text format.
    Choices - Selective grammar conditions.
    Grammar - The complete set of grammar rules for the speech engine to go by.
    Thread - A system thread.
    GrammarBuilder - Builds all of our grammar rules.

    [​IMG]

    [SIZE=medium]Loading Speech Engine[/SIZE]

    [SIZE=small]Then setup our Grammar rules. The GrammarBuilder is going to build our selective grammar choices with our dictated grammar.[/SIZE]

    [SIZE=small]Dictation Grammar - A set of rules used to translate all human speech in to digital text. Unlike selective grammar choices, dictation grammar is for non-specific grammar choices.[/SIZE]

    [SIZE=small]Now we need to initialize the speech recognizer and setup a few properties and events.[/SIZE]

    [​IMG]

    [SIZE=medium]Recognizing Speech[/SIZE]

    [SIZE=small]First lets focus on Looping our Receiving calls. We do this too accept new speech input after another speech input has been received. Under our RecThreadFunction:[/SIZE]

    [​IMG]

    Now under the function raised by the recognizer when speech has been understood, we want to handle our selective grammar choices we set and any dictated grammar. Take note how we invoke the main thread using an anonymous method. We do this so we can call functions parent to the main thread without cross threading.

    [​IMG]

    [SIZE=medium]Final Steps[/SIZE]

    [SIZE=medium]The last thing we need to do is to dispose of the recognizer on form exit. We also need to setup our enable and disable button functions. These steps are self explanatory.[/SIZE]

    [​IMG]

    Results
    [​IMG]

    [SIZE=small]I hope you enjoyed this tutorial. Please keep in mind this is the basics of getting started. Their are many more options and stages of post processing to come. Thank you.[/SIZE]

    [SIZE=small]If you have any questions or comments, please post below.[/SIZE]

    [SIZE=small]I got this tutorial off of another site so credits to the creator of the tutorial.[/SIZE]
    [SIZE=small]I'll give this a try myself and post back with my own :D[/SIZE]
     
  2. Designs

    Designs Newbie
    0/47

    Joined:
    Nov 15, 2013
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    0
    I could just imaging this inside my RTE haha. Thanks for the research and posting this mate,
     

Share This Page

Close