Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm doing a project that involves speech recognition. But here i don't just need to recognize simple commands, I need my application to identify a lengthy sentence.
I'm currently using Microsoft SAPI5.1. But when i execute my application it doesn't take what I'm saying accurately.

Can any one give me a better option of getting this done. I need to capture what I'm saying and convert it to a Text.
Please help
Posted

Well, you can try what the Microsoft Speech recognition engine could do about that using System.Speech.Recognition.SpeechRecognitionEngine.

Yes, dictating lengthy sentence is quite different from command recognition. The key difference is using the DictationGrammar. Try it with console application. Here is the application entry point:

C#
using System.Speech.Recognition;

//...

[System.MTAThread] //IMPORTANT!
static void Main() {
    SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
    Grammar dictationGrammar = new DictationGrammar();
    recognizer.LoadGrammar(dictationGrammar);
    try {
        System.Console.WriteLine("Start talking!");
        recognizer.SetInputToDefaultAudioDevice();
        RecognitionResult result = recognizer.Recognize();
        System.Console.WriteLine(result.Text);
    } catch (InvalidOperationException exception) {
        System.Console.WriteLine(
            String.Format(
                "Could not recognize input; {0}: '{1}'.",
                 exception.GetType(), exception.Message));
    } finally {
        recognizer.UnloadAllGrammars();
    }
    System.Console.WriteLine("Done. Press any key...");
    System.Console.ReadKey(true);
}


While the recognition with command-based grammar works amazingly well, you may find dictation results frustrating…
Not my fault. :-)

—SA
 
Share this answer
 
v2
Comments
Monjurul Habib 3-Jun-11 16:05pm    
nice answer, my 5.
Sergey Alexandrovich Kryukov 3-Jun-11 20:17pm    
Thank you, Monjurul.
--SA
Thilina C 4-Jun-11 0:38am    
This is good, but this is actually my question.:)
Sergey Alexandrovich Kryukov 4-Jun-11 0:43am    
What do you mean? That you already knew all that? (Than you should have indicate this clearly in your question, not waste my time.) Please explain.
All questions to Microsoft. Or look for a third-party solution.
--SA
Thilina C 4-Jun-11 1:58am    
Yes, i KNOW how to get voice as an input and when I execute your code and say some thing like "My name is jack", it doesn't take what I'm saying accurately.
Its indicating something completely different. Thats what I need to fix.

And sorry if it was a waste of your time
 
Share this answer
 
Comments
Monjurul Habib 3-Jun-11 16:05pm    
nice links, my 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900