static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { UnityEngine.Debug.Log("RECOGNIZED sentence : " + data.scores[0].sentence); UnityEngine.Debug.Log("RECOGNIZED tags : " + data.scores[0].tags); gameController.AddAction(new AppMirrorAction(data.scores[0].sentence)); }
static void Main(string[] args) { // create client instance client = new MqttClient(IPAddress.Parse(MQTT_BROKER_ADDRESS)); string clientId = Guid.NewGuid().ToString(); client.Connect(clientId, "guest", "guest"); SubscribeMessage(); isActive = false; //Init speech recognizer session = PXCMSession.CreateInstance(); SetupRecognizer(session); Console.WriteLine("Siap melayani boss..."); Console.WriteLine("Teken 'x' kalau mau mecat saya"); while (true) { ConsoleKeyInfo pressedKey = Console.ReadKey(true); char keychar = pressedKey.KeyChar; if (keychar == 'x') { break; } } Console.WriteLine("Selamat tinggal bos, senang melayani.."); client.Disconnect(); try { if (sr != null) { sr.StopRec(); sr.Dispose(); sr = null; } if (source != null) { source.Dispose(); source = null; } if (session != null) { session.Dispose(); } } catch (Exception ex) { Console.WriteLine(ex.Message + " : " + ex.StackTrace); } }
void CleanUp() { if (sr != null) { sr.Dispose(); sr = null; } if (source != null) { source.Dispose(); source = null; } }
public string AlertToString(PXCMSpeechRecognition.AlertType label) { switch (label) { case PXCMSpeechRecognition.AlertType.ALERT_SNR_LOW: return "SNR_LOW"; case PXCMSpeechRecognition.AlertType.ALERT_SPEECH_UNRECOGNIZABLE: return "SPEECH_UNRECOGNIZABLE"; case PXCMSpeechRecognition.AlertType.ALERT_VOLUME_HIGH: return "VOLUME_HIGH"; case PXCMSpeechRecognition.AlertType.ALERT_VOLUME_LOW: return "VOLUME_LOW"; case PXCMSpeechRecognition.AlertType.ALERT_SPEECH_BEGIN: return "SPEECH_BEGIN"; case PXCMSpeechRecognition.AlertType.ALERT_SPEECH_END: return "SPEECH_END"; case PXCMSpeechRecognition.AlertType.ALERT_RECOGNITION_ABORTED: return "REC_ABORT"; case PXCMSpeechRecognition.AlertType.ALERT_RECOGNITION_END: return "REC_END"; } return "Unknown"; }
static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { UnityEngine.Debug.Log("RECOGNIZED sentence : " + data.scores[0].sentence); UnityEngine.Debug.Log("RECOGNIZED tags : " + data.scores[0].tags); if (data.scores[0].sentence == "Create") UnityEngine.Debug.Log("Call Create Function"); if (data.scores[0].sentence == "Save") UnityEngine.Debug.Log("Call Save Function"); if (data.scores[0].sentence == "Load") UnityEngine.Debug.Log("Call Load Function"); if (data.scores[0].sentence == "Run") UnityEngine.Debug.Log("Call Run Function"); }
protected void Uninitialize() { try { if (this.device != null) { this.device.Dispose(); this.device = null; } if (this.recognition != null) { this.recognition.Dispose(); this.recognition = null; } if (this.audioSource != null) { this.audioSource.Dispose(); this.audioSource = null; } if (this.senseManager != null) { this.senseManager.Close(); this.senseManager.Dispose(); this.senseManager = null; } if (this.session != null) { this.session.Dispose(); this.session = null; } } catch (Exception e) { FLogger.Log(LogType.Debug, e.Message, e.StackTrace); } this.initialized = false; }
private void Uninitialize() { if (senseManager != null) { senseManager.Dispose(); senseManager = null; } if (audioSource != null) { audioSource.Dispose(); audioSource = null; } if (recognition != null) { recognition.Dispose(); recognition = null; } }
public static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { UnityEngine.Debug.Log("RECOGNIZED sentence : " + data.scores[0].sentence); UnityEngine.Debug.Log("RECOGNIZED tags : " + data.scores[0].tags); if (data.scores[0].sentence == "Initialize") { UnityEngine.Debug.Log("Initialize Link Start Function"); isReadyToLoadLevel = true; } if (data.scores[0].sentence == "Restart") { UnityEngine.Debug.Log("Restart Function"); isReadyToRestartLevel = true; } //if (data.scores[0].sentence == "Load") //{ // UnityEngine.Debug.Log("Call Load Function"); //} //if (data.scores[0].sentence == "Run") //{ // UnityEngine.Debug.Log("Call Run Function"); //} }
// 音声認識した語の通知ハンドラ // voice_recognition.cs サンプルより void OnRecognition( PXCMSpeechRecognition.RecognitionData data ) { // UIスレッドに同期的に処理を戻す context.Post( state => { ListRecognition.Items.Add( "Dictation" ); // ディクテーションモードの時はラベルがマイナスの値になる if ( data.scores[0].label < 0 ) { ListRecognition.Items.Add( data.scores[0].sentence ); } }, null ); }
private void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { FireSpeechRecognized(data.scores[0].sentence); }
private void OnAlert(PXCMSpeechRecognition.AlertData data) { Debug.WriteLine("SpeechRecognition alert: " + data.label); }
private void OnAlert(PXCMSpeechRecognition.AlertData data) { AlertDetected = data.label.ToString(); }
void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { Debug.Log("OnRecognition"); if (data.scores[0].label < 0) { form.PrintConsole(data.scores[0].sentence); if (data.scores[0].tags.Length > 0) form.PrintConsole(data.scores[0].tags); } else { form.ClearScores(); for (int i = 0; i < PXCMSpeechRecognition.NBEST_SIZE; i++) { int label = data.scores[i].label; int confidence = data.scores[i].confidence; if (label < 0 || confidence == 0) continue; form.SetScore(label, confidence); } if (data.scores[0].tags.Length > 0) form.PrintConsole(data.scores[0].tags); } }
void OnAlert(PXCMSpeechRecognition.AlertData data) { Debug.Log("OnAlert"); form.PrintStatus(form.AlertToString(data.label)); }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { // Clean up if (sr != null) { sr.Dispose(); sr = null; } if (audiosource != null) { audiosource.Dispose(); audiosource = null; } base.OnClosing(e); }
public void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { var pippo = data.scores[0].label; double spostamento = 0.3; TimeSpan durata = new TimeSpan(0, 0, 0, 500); switch (pippo) { case 1: DroneState.TakeOff(); ScriviInLista("Takeoff"); break; case 2: DroneState.Land(); ScriviInLista("Land"); break; case 4: DroneState.RotateLeftForAsync(spostamento, durata); //DroneState.RollX = .5; //Thread.Sleep(1000); //DroneState.RollX = 0; ScriviInLista("Rotate Left"); break; case 5: DroneState.RotateRightForAsync(spostamento, durata); //DroneState.RollX = .5; //Thread.Sleep(1000); //DroneState.RollX = 0; ScriviInLista("Rotate Right"); break; case 8: DroneState.GoForward(spostamento); Thread.Sleep(500); DroneState.Stop(); ScriviInLista("Advance"); break; case 16: DroneState.GoBackward(spostamento); Thread.Sleep(500); DroneState.Stop(); ScriviInLista("Back"); break; case 32: DroneState.GoUp(spostamento); Thread.Sleep(500); DroneState.Stop(); ScriviInLista("Up"); break; case 64: DroneState.GoDown(spostamento); Thread.Sleep(500); DroneState.Stop(); ScriviInLista("Down"); break; case 128: DroneState.StrafeX = .5; Thread.Sleep(500); DroneState.StrafeX = 0; ScriviInLista("Left"); break; case 256: DroneState.StrafeX = -.5; Thread.Sleep(500); DroneState.StrafeX = 0; ScriviInLista("Right"); break; case 512: DroneState.Stop(); ScriviInLista("Stop"); break; case 1024: ScriviInLista("Dance"); DroneState.RotateLeft(spostamento); Thread.Sleep(500); DroneState.RotateRight(spostamento); Thread.Sleep(500); DroneState.RotateRight(spostamento); Thread.Sleep(500); DroneState.RotateLeft(spostamento); Thread.Sleep(500); DroneState.GoForward(spostamento); Thread.Sleep(500); DroneState.GoBackward(spostamento); Thread.Sleep(500); DroneState.Stop(); break; default: break; } Debug.WriteLine(data.grammar.ToString()); Debug.WriteLine(data.scores[0].label.ToString()); Debug.WriteLine(data.scores[0].sentence); // Process Recognition Data }
void OnAlert(PXCMSpeechRecognition.AlertData data) { Debug.Log(data.label); }
private void Uninitialize() { if ( senseManager != null ) { senseManager.Dispose(); senseManager = null; } if ( audioSource != null ) { audioSource.Dispose(); audioSource = null; } if ( recognition != null ) { recognition.Dispose(); recognition = null; } }
/// <summary> /// On word recognized /// </summary> private void OnRecognition(PXCMSpeechRecognition.RecognitionData data) { if (data.scores[0].label < 0) { //sentencesRecognized.Add(data.scores[0].sentence); //if (data.scores[0].tags.Length > 0) //{ //tagsRecognized.Add(data.scores[0].tags); //} } else { for (int i = 0; i < PXCMSpeechRecognition.NBEST_SIZE; i++) { int label = data.scores[i].label; int confidence = data.scores[i].confidence; if (label < 0 || confidence == 0) continue; if (Commands.GetLength(0) < label) { Debug.Log("VoiceThreadError - UnrecognizedLabel"); SetError(SpeechManagerErrorType.VoiceThreadError_UnrecognizedLabel); continue; } if (commanndsRecognized.ContainsKey(Commands[label])) { commanndsRecognized.Remove(Commands[label]); } commanndsRecognized.Add(Commands[label],confidence); } } }
/// <summary> /// On Alert /// </summary> private void OnAlert(PXCMSpeechRecognition.AlertData data) { AlertDetected = data.label.ToString(); SetError(SpeechManagerErrorType.AlertDetected); }
private string LanguageToString(PXCMSpeechRecognition.LanguageType language) { switch (language) { case PXCMSpeechRecognition.LanguageType.LANGUAGE_US_ENGLISH: return "US English"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_GB_ENGLISH: return "British English"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_DE_GERMAN: return "Deutsch"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_IT_ITALIAN: return "Italiano"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_BR_PORTUGUESE: return "BR Português"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_CN_CHINESE: return "中文"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_FR_FRENCH: return "Français"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_JP_JAPANESE: return "日本語"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_US_SPANISH: return "US Español"; case PXCMSpeechRecognition.LanguageType.LANGUAGE_LA_SPANISH: return "LA Español"; } return null; }
// 音声認識した語の通知ハンドラ void OnRecognition( PXCMSpeechRecognition.RecognitionData data ) { // UIスレッドに同期的に処理を戻す context.Post( state => { ListRecognition.Items.Add("Command"); // コマンドモードの時はラベルに登録したコマンドのインデックスが設定される for ( int i = 0; i < PXCMSpeechRecognition.NBEST_SIZE; i++ ) { if ( data.scores[i].label < 0 || data.scores[i].confidence == 0 ) { continue; } // 認識した語が信頼性の高い順に設定される ListRecognition.Items.Add( string.Format( "{0}, {1}, {2}", data.scores[i].label, data.scores[i].confidence, data.scores[i].sentence ) ); } }, null ); }