Speech Recognition does not work RRS feed

  • Question

  • Hi there.

    I wrote a programm for gesture recognition with the kinect in C# with Kinect SDK 1.7.
    Now I want to add some voice commands. I installed all packages (Speech SDK, Runtime, Language Packs, etc).
    The Speech Example does work. I basically copied most of the code from the example to add to my code:

    private SpeechRecognitionEngine speechEngine; private static RecognizerInfo GetKinectRecognizer() { foreach (RecognizerInfo recognizer in SpeechRecognitionEngine.InstalledRecognizers()) { string value; recognizer.AdditionalInfo.TryGetValue("Kinect", out value); if ("True".Equals(value, StringComparison.OrdinalIgnoreCase) && "en-US".Equals(recognizer.Culture.Name, StringComparison.OrdinalIgnoreCase)) { return recognizer; } } return null; } //------- private void SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { // Speech utterance confidence below which we treat speech as if it hadn't been heard const double ConfidenceThreshold = 0.3; if (e.Result.Confidence >= ConfidenceThreshold) { switch (e.Result.Semantics.Value.ToString()) { case "TEST": someFunction(); break; } } } private void SpeechRejected(object sender, SpeechRecognitionRejectedEventArgs e) { someOtherFunktion(); } private void WindowLoaded(object sender, RoutedEventArgs e) { RecognizerInfo ri = GetKinectRecognizer(); if (null != ri) { this.speechEngine = new SpeechRecognitionEngine(ri.Id); var sprachbefehle = new Choices(); sprachbefehle.Add(new SemanticResultValue("test", "TEST")); var gb = new GrammarBuilder { Culture = ri.Culture }; gb.Append(sprachbefehle); var g = new Grammar(gb); speechEngine.SpeechRecognized += SpeechRecognized; speechEngine.SpeechRecognitionRejected += SpeechRejected;
    speechEngine.SetInputToAudioStream(sensor.AudioSource.Start(), new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null)); speechEngine.RecognizeAsync(RecognizeMode.Multiple); } }

    There is more code, but not related to the speech things.

    I think there is a problem with "speechEngine.RecognizeAsync(RecognizeMode.Multiple);"

    Can someone please help me with this?

    Wednesday, September 11, 2013 3:10 PM


All replies