65.9K
CodeProject is changing. Read more.
Home

SpeechRecognition Windows Phone 8 c#

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.50/5 (4 votes)

Aug 7, 2014

CPOL
viewsIcon

10372

The easy way to use speech Recognition by converting Speech to Text

Introduction

Sometimes , we don't want to type some words by keyboard in the App , if you got tired and you want just speech so here is the solution.

Using the code

First of all , you need to add the Capability ID_CAP_SPEECH_RECOGNITION on the Manifest file.

we create an instance of  SpeechRecognitionResult.

 SpeechRecognitionResult recoResult = await myRecognizer.RecognizeAsync();

The speech will be Translated by bing. if it recognise what you said as the correct language it will return it as a Text else it will return an erreur.

            try
            
              {
               
               

                // Check to see if speech input was rejected and prompt the user.
                if (recoResult.TextConfidence == SpeechRecognitionConfidence.Rejected)
                {
                   test  = "Sorry, didn't catch that. \n\nSay again.";
                 
                }

                // Check to see if speech input was recognized with low confidence and prompt the                 // user to speak again.
                else if (recoResult.TextConfidence == SpeechRecognitionConfidence.Low)
                {
                    test  = "Not sure what you said. \n\nSay again.";

                }

                // Check to see if speech input was recognized and confirm the result.
                else if (recoResult.TextConfidence == SpeechRecognitionConfidence.High ||
                      recoResult.TextConfidence == SpeechRecognitionConfidence.Medium)
                {

                        MessageBox.Show(recoResult.Text);
                }
              
            }
            catch (Exception ee)
            {

               //erreur
            }

 

You just implement this code , you should change the language on the Settings on you device.

History

You can know create many usefull Apps , what are you waiting for ! ;)