public void UnPause() { var said = new SaidSomethingEventArgs(); said.Verb = Verbs.Resume; said.Matched = "Kinect Unpause"; paused = false; if (SaidSomething != null) { SaidSomething(new object(), said); } }
public void Pause() { var said = new SaidSomethingEventArgs(); said.Verb = Verbs.Pause; said.Matched = "Kinect Pause"; paused = true; if (SaidSomething != null) { SaidSomething(new object(), said); } }
private void SreSpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e) { var said = new SaidSomethingEventArgs { Verb = Verbs.None, Matched = "?" }; if (SaidSomething != null) { SaidSomething(new object(), said); } Console.WriteLine("\nSpeech Rejected"); }
void sre_SpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e) { var said = new SaidSomethingEventArgs(); said.Verb = Verbs.None; said.Matched = "?"; //Kinect SDK TODO: should make sure after Stop, that we don't get Speech event calls. if (SaidSomething != null) { SaidSomething(new object(), said); } System.Diagnostics.Debug.WriteLine("\nSpeech Rejected"); }
private void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text); if ((this.SaidSomething == null) || (e.Result.Confidence < 0.3)) { return; } var said = new SaidSomethingEventArgs { RgbColor = System.Windows.Media.Color.FromRgb(0, 0, 0), Shape = 0, Verb = 0, Phrase = e.Result.Text }; // Look for a match in the order of the lists below, first match wins. List <Dictionary <string, WhatSaid> > allDicts = new List <Dictionary <string, WhatSaid> > { this.gameplayPhrases, this.singlePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.Verb; said.Shape = phrase.Value.Shape; said.Matched = phrase.Key; said.RgbColor = phrase.Value.Color; found = true; break; } } } if (!found) { return; } if (this.SaidSomething != null) { this.SaidSomething(new object(), said); } }
private void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text); if ((this.SaidSomething == null) || (e.Result.Confidence < 0.3)) { return; } var said = new SaidSomethingEventArgs { RgbColor = System.Windows.Media.Color.FromRgb(0, 0, 0), Shape = 0, Verb = 0, Phrase = e.Result.Text }; bool found = false; foreach (var phrase in this.controlPhrases) { if (e.Result.Text.Contains(phrase.Key)) { said.RgbColor = phrase.Value.Color; said.Matched = phrase.Key; said.Verb = phrase.Value.Verb; found = true; break; } } if (!found) { return; } if (this.SaidSomething != null) { this.SaidSomething(new object(), said); } }
private void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text); if ((this.SaidSomething == null) || (e.Result.Confidence < 0.7)) { return; } var said = new SaidSomethingEventArgs { Verb = 0, Phrase = e.Result.Text }; // Look for a match in the order of the lists below, first match wins. List<Dictionary<string, WhatSaid>> allDicts = new List<Dictionary<string, WhatSaid>> { this.singlePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.Verb; found = true; break; } } } if (!found) { return; } if (this.SaidSomething != null) { this.SaidSomething(new object(), said); } }
private void SreSpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e) { var said = new SaidSomethingEventArgs { Verb = Verbs.None, Matched = "?" }; if (this.SaidSomething != null) { this.SaidSomething(new object(), said); } Console.WriteLine("\nSpeech Rejected"); }
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text); if (SaidSomething == null) return; var said = new SaidSomethingEventArgs(); said.RGBColor = Color.FromRgb(0, 0, 0); said.Shape = 0; said.Verb = 0; said.Phrase = e.Result.Text; // First check for color, in case both color _and_ shape were both spoken bool foundColor = false; foreach (var phrase in ColorPhrases) if (e.Result.Text.Contains(phrase.Key) && (phrase.Value.verb == Verbs.Colorize)) { said.RGBColor = phrase.Value.color; said.Matched = phrase.Key; foundColor = true; break; } // Look for a match in the order of the lists below, first match wins. List<Dictionary<string, WhatSaid>> allDicts = new List<Dictionary<string, WhatSaid>>() { GameplayPhrases, ShapePhrases, ColorPhrases, SinglePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.verb; said.Shape = phrase.Value.shape; if ((said.Verb == Verbs.DoShapes) && (foundColor)) { said.Verb = Verbs.ShapesAndColors; said.Matched += " " + phrase.Key; } else { said.Matched = phrase.Key; said.RGBColor = phrase.Value.color; } found = true; break; } } } if (!found) return; if (paused) // Only accept restart or reset { if ((said.Verb != Verbs.Resume) && (said.Verb != Verbs.Reset)) return; paused = false; } else { if (said.Verb == Verbs.Resume) return; } if (said.Verb == Verbs.Pause) paused = true; if (SaidSomething != null) { SaidSomething(new object(), said); } }
void sre_SpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e) { var said = new SaidSomethingEventArgs(); said.Verb = Verbs.None; said.Matched = "?"; //Kinect SDK TODO: should make sure after Stop, that we don't get Speech event calls. if (SaidSomething != null) { SaidSomething(new object(), said); } Console.WriteLine("\nSpeech Rejected"); }
private void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text); if ((this.SaidSomething == null) || (e.Result.Confidence < 0.3)) { return; } var said = new SaidSomethingEventArgs { RgbColor = System.Windows.Media.Color.FromRgb(0, 0, 0), Verb = 0, Phrase = e.Result.Text }; // First check for color, in case both color _and_ shape were both spoken bool foundColor = false; foreach (var phrase in this.colorPhrases) { if (e.Result.Text.Contains(phrase.Key) && (phrase.Value.Verb == Verbs.Colorize)) { said.RgbColor = phrase.Value.Color; said.Matched = phrase.Key; foundColor = true; break; } } // Look for a match in the order of the lists below, first match wins. List<Dictionary<string, WhatSaid>> allDicts = new List<Dictionary<string, WhatSaid>> { this.gameplayPhrases, this.colorPhrases, this.singlePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.Verb; if ((said.Verb == Verbs.DoShapes) && foundColor) { said.Verb = Verbs.ShapesAndColors; said.Matched += " " + phrase.Key; } else { said.Matched = phrase.Key; said.RgbColor = phrase.Value.Color; } found = true; break; } } } if (!found) { return; } if (this.paused) { // Only accept restart or reset if ((said.Verb != Verbs.Resume) && (said.Verb != Verbs.Reset)) { return; } this.paused = false; } else { if (said.Verb == Verbs.Resume) { return; } } if (said.Verb == Verbs.Pause) { this.paused = true; } if (this.SaidSomething != null) { this.SaidSomething(new object(), said); } }
private void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text); if ((SaidSomething == null) || (e.Result.Confidence < 0.3)) { return; } var said = new SaidSomethingEventArgs { RgbColor = Color.FromRgb(0, 0, 0), Shape = 0, Verb = 0, Phrase = e.Result.Text }; // First check for color, in case both color _and_ shape were both spoken bool foundColor = false; foreach (var phrase in colorPhrases) { if (e.Result.Text.Contains(phrase.Key) && (phrase.Value.Verb == Verbs.Colorize)) { said.RgbColor = phrase.Value.Color; said.Matched = phrase.Key; foundColor = true; break; } } // Look for a match in the order of the lists below, first match wins. List <Dictionary <string, WhatSaid> > allDicts = new List <Dictionary <string, WhatSaid> > { gameplayPhrases, shapePhrases, colorPhrases, singlePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.Verb; said.Shape = phrase.Value.Shape; if ((said.Verb == Verbs.DoShapes) && foundColor) { said.Verb = Verbs.ShapesAndColors; said.Matched += " " + phrase.Key; } else { said.Matched = phrase.Key; said.RgbColor = phrase.Value.Color; } found = true; break; } } } if (!found) { return; } if (paused) { // Only accept restart or reset if ((said.Verb != Verbs.Resume) && (said.Verb != Verbs.Reset)) { return; } paused = false; } else { if (said.Verb == Verbs.Resume) { return; } } if (said.Verb == Verbs.Pause) { paused = true; } if (SaidSomething != null) { SaidSomething(new object(), said); } }
private void SreSpeechRecognized(object sender, SpeechRecognizedEventArgs e) { if (speechEnabled) { Console.WriteLine("\rSpeech Recognized: \t{0} - \t{1}", e.Result.Text, e.Result.Confidence); if ((this.SaidSomething == null) || (e.Result.Confidence < 0.65)) { return; } if (!this.paused) { resetSpeechTimeout(); //Reset the silence timeout if we think something was said } var said = new SaidSomethingEventArgs { Verb = 0, Phrase = e.Result.Text }; // Look for a match in the order of the lists below, first match wins. List<Dictionary<string, WhatSaid>> allDicts = new List<Dictionary<string, WhatSaid>> { this.startListeningPhrases, this.stopListeningPhrases, this.booleanPhrases, this.kinectMotorPhrases, this.startScreenPhrases, this.instrumentPhrases, this.wallPhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.EndsWith(phrase.Key)) { said.Verb = phrase.Value.Verb; said.Matched = phrase.Key; found = true; break; } } } if (!found) { return; } if (this.paused) { // Only accept start listening if ((said.Verb == Verbs.SpeechStart)) { toggleListening(true); } } else { if (said.Verb == Verbs.SpeechStart) { return; } if (said.Verb == Verbs.SpeechStop) { toggleListening(false); } } if (this.SaidSomething != null) { this.SaidSomething(new object(), said); } } }
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { Console.Write("\rSpeech Recognized: \t{0}", e.Result.Text); if (speechPause) { return; } if (SaidSomething == null) { return; } var said = new SaidSomethingEventArgs(); if (e.Result.Confidence < mConfiLvel) { if (e.Result.Confidence > mConfiLvel * mLowerConfiLevel) { said.Verb = Verbs.None; //said.Matched = "Say that again?"; if (SaidSomething != null) { SaidSomething(new object(), said); } } return; } else { said.Verb = 0; said.Phrase = e.Result.Text; } // Look for a match in the order of the lists below, first match wins. List <Dictionary <string, WhatSaid> > allDicts = new List <Dictionary <string, WhatSaid> >() { InModePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.verb; said.Matched = phrase.Key; found = true; break; } } } if (!found) { return; } if (paused) // Only accept Unpause { if ((said.Verb != Verbs.Resume)) { return; } paused = false; } else { if (said.Verb == Verbs.Resume) { return; } } // Speech Feedback speech.SpeakAsync(said.Matched); if (said.Verb == Verbs.Pause) { paused = true; } if (SaidSomething != null) { SaidSomething(new object(), said); } }
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { System.Diagnostics.Debug.Write("\rSpeech Recognized: \t{0}" + e.Result.Text + ", Confidence: " + e.Result.Confidence + "\n"); if (SaidSomething == null) return; if (e.Result.Confidence < 0.7) return; var said = new SaidSomethingEventArgs(); //said.RGBColor = Color.FromRgb(0, 0, 0); //said.Verb = 0; said.Phrase = e.Result.Text; // Look for a match in the order of the lists below, first match wins. List<Dictionary<string, WhatSaid>> allDicts = new List<Dictionary<string, WhatSaid>>() { GameplayPhrases, ColorPhrases, SinglePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.verb; said.Matched = phrase.Key; said.RGBColor = phrase.Value.color; found = true; break; } } } if (!found) return; //if (paused) // Only accept restart or reset //{ // if ((said.Verb != Verbs.Resume) && (said.Verb != Verbs.Reset)) // return; // paused = false; //} //else //{ // if (said.Verb == Verbs.Resume) // return; //} //if (said.Verb == Verbs.Pause) // paused = true; if (SaidSomething != null) { SaidSomething(new object(), said); } }
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { System.Diagnostics.Debug.Write("\rSpeech Recognized: \t{0}" + e.Result.Text + ", Confidence: " + e.Result.Confidence + "\n"); if (SaidSomething == null) { return; } if (e.Result.Confidence < 0.7) { return; } var said = new SaidSomethingEventArgs(); //said.RGBColor = Color.FromRgb(0, 0, 0); //said.Verb = 0; said.Phrase = e.Result.Text; // Look for a match in the order of the lists below, first match wins. List <Dictionary <string, WhatSaid> > allDicts = new List <Dictionary <string, WhatSaid> >() { GameplayPhrases, ColorPhrases, SinglePhrases }; bool found = false; for (int i = 0; i < allDicts.Count && !found; ++i) { foreach (var phrase in allDicts[i]) { if (e.Result.Text.Contains(phrase.Key)) { said.Verb = phrase.Value.verb; said.Matched = phrase.Key; said.RGBColor = phrase.Value.color; found = true; break; } } } if (!found) { return; } //if (paused) // Only accept restart or reset //{ // if ((said.Verb != Verbs.Resume) && (said.Verb != Verbs.Reset)) // return; // paused = false; //} //else //{ // if (said.Verb == Verbs.Resume) // return; //} //if (said.Verb == Verbs.Pause) // paused = true; if (SaidSomething != null) { SaidSomething(new object(), said); } }