none
Kinect voice recognition engine always giving SpeechRecognitionRejected event RRS feed

  • Question

  • Hi, can anyone give me the solution for my problem will be welcome..

    My code looks something like this...

     

    namespace AudioRecorder

    {

        /// <summary>

        /// Interaction logic for MainWindow.xaml

        /// </summary>

        public partial class MainWindow : Window

        {

            public MainWindow()

            {

                InitializeComponent();

            }

     

            SpeechRecognitionEngine sre = null;

            private void RecordButton_Click(object sender, RoutedEventArgs e)

            {

                try

                {

                    sre = new SpeechRecognitionEngine();

                    sre.SetInputToDefaultAudioDevice();

     

                    Choices choices = new Choices("left", "right", "top", "down");

                    GrammarBuilder gb = new GrammarBuilder(choices);

                    Grammar grammar = new Grammar(gb);

                    sre.LoadGrammar(grammar);

     

                    sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);

                    sre.SpeechRecognitionRejected += new EventHandler<SpeechRecognitionRejectedEventArgs>(sre_SpeechRecognitionRejected);

                    sre.RecognizeAsync(RecognizeMode.Multiple);

                }

                catch (Exception ex)

                {

                    MessageBox.Show(ex.Message);

                }

            }

     

            void sre_SpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e)

            {

                MessageBox.Show("Speech rejected");

            }

     

            void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)

            {

                try

                {

                    foreach (RecognizedWordUnit rw in e.Result.Words)

                    {

                        switch (rw.Text)

                        {

                            case "left":

                                MessageBox.Show("left");

                                break;

                            case "right":

                                MessageBox.Show("right");

                                break;

                            case "top":

                                MessageBox.Show("top");

                                break;

                            case "bottom":

                                MessageBox.Show("down");

                                break;

                            default:

                                MessageBox.Show("Default");

                                break;

                        }

                    }

                }

                catch (Exception ex)

                {

                    MessageBox.Show(ex.Message);

                }

            }

        }

    }

    So here i did following steps and got the problem:

    1. Ran the application... 

     

    Now the problem is...

    2. When i said "left" or whatever SpeechRecognitionEngine always giving me SpeechRecognitionRejected  event instead of  SpeechRecognized event. So i am always getting "Speech rejected" in messagebox.

     

    Please can anyone help me regarding this...

    Friday, July 22, 2011 1:56 PM

Answers

  • Is your machine configured on a different culture/languge than english? The following code could help you make sure the speech recognizer is configured for the language you expect:
     
    RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers().Where(r => r.Id == "SR_MS_en-US_Kinect_10.0").FirstOrDefault();
    GrammarBuilder gb = new GrammarBuilder();
    gb.Culture = ri.Culture;
    gb.Append(choices);
    Grammar grammar = new Grammar(gb);
    Hope this helps,
    Eddy

    I'm here to help
    Friday, July 22, 2011 9:04 PM
  • Thanks, Eddy for replying i found the solution actually...

    I have not installed "MSKinectLangPack_enUS.msi".

    I installed and ran my application it worked. Thanks a lot again.

     



    jnana.rana.2005
    Monday, July 25, 2011 9:09 AM

All replies

  • Is your machine configured on a different culture/languge than english? The following code could help you make sure the speech recognizer is configured for the language you expect:
     
    RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers().Where(r => r.Id == "SR_MS_en-US_Kinect_10.0").FirstOrDefault();
    GrammarBuilder gb = new GrammarBuilder();
    gb.Culture = ri.Culture;
    gb.Append(choices);
    Grammar grammar = new Grammar(gb);
    Hope this helps,
    Eddy

    I'm here to help
    Friday, July 22, 2011 9:04 PM
  • Hi Eddy,

     I am very much thankful to you that you at least responded to my concern thanks again.

     

    answering to your 1st question.

    1. Yes my computer is configured using English(United States).

    2. RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers().Where(r => r.Id == "SR_MS_en-US_Kinect_10.0").FirstOrDefault();

    here ri is comming null. When i investigated more i found that SpeechRecognitionEngine.InstalledRecognizers().id = SR_MS_ZXX_Lightweight_v10.0;

    and this is the only RecognizerInfo's ID.

    3. But eddy, In SpeechRecognitionEngine, its giving "Speech Detected" event.

    So i am not getting where is my problem.

    Thanks.




    jnana.rana.2005
    Monday, July 25, 2011 6:59 AM
  • Thanks, Eddy for replying i found the solution actually...

    I have not installed "MSKinectLangPack_enUS.msi".

    I installed and ran my application it worked. Thanks a lot again.

     



    jnana.rana.2005
    Monday, July 25, 2011 9:09 AM