protected void OnRecognitionSuccessful(string ID, RecognitionSuccess res) { if (RecognitionSuccessful != null) { RecognitionSuccessful(this, new RecognitionSuccessfulEventArgs(this, ID, res)); } }
public bool OnSpeechRecognised(string ID, RecognitionSuccess result) { string room = ""; if (result.getSemanticValuesAsString("room") != null) room = result.getSemanticValuesAsString("room"); string item = ""; if (result.getSemanticValuesAsString("item") != null) item = result.getSemanticValuesAsString("item"); string action = ""; if (result.getSemanticValuesAsString("action") != null) action = result.getSemanticValuesAsString("action"); Command c = new Command(room, item, action, this); Form1.server.protos.Execute(c); return true; }
protected void OnRecognitionSuccessful(string ID, RecognitionResult res) { RecognitionSuccess ret = new RecognitionSuccess(this, res); base.OnRecognitionSuccessful(ID, ret); }
public bool OnSpeechRecognised(string ID, RecognitionSuccess result) { string matched = ""; string cmd = ""; if (result.getSemanticValuesAsString("command")!=null) cmd = result.getSemanticValuesAsString("command"); if (cmd == "turn off alarm") { if (lastAlarm == null) return false; lock (timers) { if (timers.ContainsKey(lastAlarm)) { timers[lastAlarm].Item1.Dispose(); timers.Remove(lastAlarm); matched = lastAlarm; lastAlarm = null; } } } if (matched != "") { OnControllableEvent(this, new IControllableEventArgs(matched, "removed")); return true; } return false; }
bool FilterRecognised(string ID, RecognitionSuccess res) { Stream s = new MemoryStream(); if(res.Audio != null) res.Audio.WriteToAudioStream(s); double avg = AudioProtoConnection.AnalyseStream(s); double noise = p.GetNoiseLevel(ID); ///////// Confidence if (res.Confidence < 0.90) { Form1.updateLog(" Confidence too low, skipping", ELogLevel.Info, ELogType.SpeechRecog); return false; } Form1.updateLog("Recog hit: (conf=" + res.Confidence.ToString() + ",volume=" + avg.ToString() + ",noise=" + noise.ToString() + ") " + res.Text, ELogLevel.Info, ELogType.SpeechRecog); ////////// Sound vs Noise if (avg < noise + 50 || avg<100) { Form1.updateLog(" Volume too low (avg=" + avg.ToString() + " noise=" + noise.ToString() + "), skipping", ELogLevel.Info, ELogType.SpeechRecog); return false; } ////////// Word Confidence foreach (int idx in res.WordConfidence.Keys) { if (res.WordConfidence[idx].Item2 < 0.4) { Form1.updateLog(" Word confidence too low, skipping (wd=" + res.WordConfidence[idx].Item1 + ", conf=" + res.WordConfidence[idx].Item2.ToString() + ")", ELogLevel.Info, ELogType.SpeechRecog); return false; } } UpdateControl(ID, (int)avg); return true; }
public bool OnSpeechRecognised(string ID, RecognitionSuccess result) { //ID: source of the audio. Normally IPaddress:port string cmd = ""; if (result.getSemanticValuesAsString("command") != null) cmd = result.getSemanticValuesAsString("command"); if (cmd == "play show" || cmd == "resume show") { int tvshowid = result.getSemanticValueAsInt("tvshowid"); int episode = result.getSemanticValueAsInt("episodeval"); int season = result.getSemanticValueAsInt("seasonval"); if (tvshowid != -1 && episode != -1 && season != -1) { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, tvshowid, season, episode)); return true; } } else if (cmd == "play movie" || cmd == "resume movie") { int movieid = result.getSemanticValueAsInt("movieid"); if (movieid != -1) { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, movieid, 0, 0)); return true; } } else if (cmd == "stop media" || cmd == "pause media" || cmd == "resume media") { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, 0, 0, 0)); return true; } else if (cmd == "play me some") { //genre music int genreid = result.getSemanticValueAsInt("genreid"); if (genreid != -1) { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, genreid, 0, 0)); return true; } } return false; }
public RecognitionAttempt_Engine(AudioRecog eng) { Engine = eng; isRunning = false; isComplete = false; Success = null; }
public void Recognised(AudioRecog engine, RecognitionSuccess success) { if (!AttemptByEngine.ContainsKey(engine)) { Form1.updateLog("ERR: Complete for unknown engine", ELogLevel.Error, ELogType.SpeechRecog); return; } AttemptByEngine[engine].TimeRecog = DateTime.Now; AttemptByEngine[engine].Success = success; }
protected void OnRecognitionSuccessful(AudioRecog engine, string ID, RecognitionSuccess res) { if (RecognitionSuccessful != null) { RecognitionSuccessful(this, new RecognitionSuccessfulEventArgs(engine, ID, res)); } }