bool textoCompleto = false; //VARIABLE PARA CONTROLAR TEXTO RECONOCIDO TOTALMENTE /*METODO DE INICIO DE ESCENA*/ void Start() { Screen.orientation = ScreenOrientation.Landscape; //ROTO PANTALLA modoVibracion = PlayerPrefs.GetString("ModoVibracion"); //SETEO MODO DE VIBRACION SELECCIONADO EN OPCIONES //INSTANCIO OBJETO DE RECONOCIMIENTO DE VOZ SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onErrorDuringRecording.AddListener(OnError); //RESETEA ESCUCHA AL CABO DE UNOS SEGUNDOS DE INACTIVIDAD listener.onFinalResults.AddListener(OnFinalResult); //METODO QUE CAPTURA RESULTADO FINAL DE RECONOCIMIENTO //SETEO MODO DE RECONOCIMIENTO SELECCIONADO EN OPCIONES if (PlayerPrefs.GetString("ModoReconocimiento") == "0") { listener.onPartialResults.AddListener(OnPartialResult); //METODO QUE CAPTURA RESULTADO PARCIAL DE RECONOCIMIENTO } else if (PlayerPrefs.GetString("ModoReconocimiento") == "1") { listener.onPartialResults.AddListener(OnPartialResultPalabraClave); //METODO QUE CAPTURA RESULTADO PARCIAL DE RECONOCIMIENTO } //VARIABLES PARA MANEJAR TEXTO DE LA ESCENA ACTIVA textoEscena = sceneText.text = "érase una vez en un bosque"; palabrasEscena = textoEscena.Split(' '); cantPalabrasEscena = palabrasEscena.Length; //GAMEOBJECTS PARA MANEJAR SONIDOS ambienteBosque = GetComponent <AudioSource> (); ambienteBosque.clip = CerditoOink; ActivarEscucha(); //ACTIVO ESCUCHA imagenNegra.Play("FadeIN"); //ACTIVO ANIMACION FADE }
void Start() { Screen.orientation = ScreenOrientation.Landscape; if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); startRecordingButton.enabled = false; SpeechRecognizer.RequestAccess(); //obtengo cantidad de palabras de escena actual textoEscena = sceneText.text; palabrasEscena = textoEscena.Split(' '); } else { resultErrores.text = "Sorry, but this device doesn't support speech recognition"; startRecordingButton.enabled = false; } OnStartRecordingPressed(); }
public void Run() { if (SpeechRecognizer.ExistsOnDevice()) { resultText.text = "I am running run"; SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); //startRecordingButton.enabled = false; SpeechRecognizer.RequestAccess(); SpeechRecognizer.StartRecording(true); resultText.text = "Say something :-)"; } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; Debug.Log("Next Command is crossfade from run function"); //GameObject.FindGameObjectWithTag("twohand)").GetComponent<Animator>().CrossFade("V", -1); //startRecordingButton.enabled = false; } }
void Start() { modelKeys = new Dictionary <string, string> (); voice = new Dictionary <string, string> (); //set keys and voices for chaacters modelKeys.Add("salesgirl", "e89bde30c4df474184629e61f9e83754"); modelKeys.Add("security", "c185fcc801ca49069c23e2271fed6fbf"); modelKeys.Add("rsecurity", "ef5c8d622cc24b81866bf2f2d6b11f2b"); voice.Add("salesgirl", "en-gb-x-rjs#female_3-local"); voice.Add("security", "en-us-x-sfg#male_3-local"); voice.Add("rsecurity", "en-us-x-sfg#male_3-local"); if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); startRecordingButton.enabled = false; SpeechRecognizer.RequestAccess(); } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; startRecordingButton.enabled = false; } }
void Start() { Screen.orientation = ScreenOrientation.Landscape; modoVibracion = PlayerPrefs.GetString("ModoVibracion"); SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onErrorDuringRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); if (PlayerPrefs.GetString("ModoReconocimiento") == "0") { listener.onPartialResults.AddListener(OnPartialResult); } else if (PlayerPrefs.GetString("ModoReconocimiento") == "1") { listener.onPartialResults.AddListener(OnPartialResultPalabraClave); } textoEscena = sceneText.text = "había una vez"; palabrasEscena = textoEscena.Split(' '); cantPalabrasEscena = palabrasEscena.Length; ActivarEscucha(); imagenNegra.Play("FadeIN"); }
//Stop the recognizer if it is running. This clears the recognizer cache. //Initialise the variables and controllers. By default the microphone is inactive. void Start() { temporaryDialogueResponse = ""; RecognizerStop(); micIsActive = false; animController = FindObjectOfType <AnimationController>(); dialogueController = FindObjectOfType <DialogController>(); if (SpeechRecognizer.ExistsOnDevice()) { debugText.text = "Speech recogniser is enabled"; SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); //listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(RecognizerStop); micIsActive = false; SpeechRecognizer.RequestAccess(); } else { dialogueController.playerText.text = "Sorry, but this device doesn't support speech recognition"; } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "door") { dooraudio.Play(); EasyTTSUtil.SpeechAdd("this is door."); SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); SpeechRecognizer.RequestAccess(); EasyTTSUtil.SpeechAdd("passed request"); if (SpeechRecognizer.IsRecording()) { EasyTTSUtil.SpeechAdd("Stoping recording"); SpeechRecognizer.StopIfRecording(); } else { SpeechRecognizer.StartRecording(true); EasyTTSUtil.SpeechAdd("Start recording"); } EasyTTSUtil.SpeechAdd(resultText); EasyTTSUtil.SpeechAdd("and finihsed testing"); } }
void Start() { Screen.orientation = ScreenOrientation.Landscape; modoVibracion = PlayerPrefs.GetString("ModoVibracion"); SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onErrorDuringRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); if (PlayerPrefs.GetString("ModoReconocimiento") == "0") { listener.onPartialResults.AddListener(OnPartialResult); } else if (PlayerPrefs.GetString("ModoReconocimiento") == "1") { listener.onPartialResults.AddListener(OnPartialResultPalabraClave); } textoEscena = sceneText.text = "la noche comienza"; palabrasEscena = textoEscena.Split(' '); cantPalabrasEscena = palabrasEscena.Length; ambienteBosque = GetComponent <AudioSource> (); ambienteBosque.clip = buho; player.SetActive(true); bosque.SetActive(true); ActivarEscucha(); imagenNegra.Play("FadeIN"); }
void Start() { if (SpeechRecognizer.ExistsOnDevice()) { resultText.text = "I am running start"; SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); //startRecordingButton.enabled = false; anim = GetComponent <Animator>(); SpeechRecognizer.RequestAccess(); SpeechRecognizer.StartRecording(true); resultText.text = "Say something :-)"; } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; //startRecordingButton.enabled = false; } }
void Start() { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onErrorDuringRecording.AddListener(OnError); //NECESARIO, CUANDO ESTA ACTIVO POR MAS DE 5S TIRA ERROR PARA RESETEARSE LA ESCUCHA listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); ActivarEscucha(); }
void Start() { _ThrustersForwardEnabled = false; _ThrustersReverseEnabled = false; _YawLeftEnabled = false; _YawRightEnabled = false; _PitchUpEnabled = false; _PitchDownEnabled = false; _DockedToMagellan = false; _DockedToStation = false; _EnginesEnabled = true; if (ResetSwitch != null) { ResetSwitch.SetActive(false); } if (StatusText != null) { StatusText.text = "IDLE"; _StaticStatus = StatusText.text; } if (ThrustUpgradeText != null) { ThrustUpgradeText.text = ((int)((_ThrustPercentage - 1) * 100)).ToString() + "%"; } if (SpeechRecognizer.ExistsOnDevice()) { if (ComputerNotificationAudioSource != null) { ComputerNotificationAudioSource.Play(); } SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); SpeechRecognizer.SetDetectionLanguage("en-US"); SpeechRecognizer.RequestAccess(); } else { if (StatusText != null) { StatusText.text = "IDLE - VOICE COMMANDS NOT SUPPORTED"; _StaticStatus = StatusText.text; } } }
void Start() { /* And get and set up the UI elements. */ instruction = GetComponentsInChildren <Text>()[0]; Button recordingButton = GetComponent <Button>(); recordingButton.onClick.AddListener(this.recordMic); /* Create the SpeechRecognitionListener. */ listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onEndOfSpeech.AddListener(this.speechEnd); }
public void Run() { //anim = GetComponent<Animator>(); //initialize FaceTracker faceTracker = new FaceTracker(tracker_model_json_filepath); //initialize FaceTrackerParams faceTrackerParams = new FaceTrackerParams(); cascade = new CascadeClassifier(); cascade.load(haarcascade_frontalface_alt_xml_filepath); // if (cascade.empty()) // { // Debug.LogError("cascade file is not loaded.Please copy from “FaceTrackerExample/StreamingAssets/” to “Assets/StreamingAssets/” folder. "); // } #if UNITY_ANDROID && !UNITY_EDITOR // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2). webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true; #endif webCamTextureToMatHelper.Initialize(); if (SpeechRecognizer.ExistsOnDevice()) { resultText.text = "I am running run"; SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); //startRecordingButton.enabled = false; SpeechRecognizer.RequestAccess(); SpeechRecognizer.StartRecording(true); resultText.text = "Say something :-)"; } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; Debug.Log("Next Command is crossfade from run function"); //GameObject.FindGameObjectWithTag("twohand)").GetComponent<Animator>().CrossFade("V", -1); //startRecordingButton.enabled = false; } }
void Start() { if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); startRecordingButton.enabled = false; SpeechRecognizer.RequestAccess(); } else { //resultText.text = "Sorry, but this device doesn't support speech recognition"; startRecordingButton.enabled = false; } }
void Start() { if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); //listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); SpeechRecognizer.RequestAccess(); } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; } spawnAndGuide = GameObject.Find("ARSessionOrigin").GetComponent <SpawnAndGuide>(); assistantSpeak = GetComponent <AssistantSpeak>(); resultText = GameObject.Find("VoiceText").GetComponent <Text>(); }
void Start() { if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); /* Add a bunch of listeners for all events from speech recognition. */ listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); startRecordingButton.enabled = false; /* As for permission to record. */ SpeechRecognizer.RequestAccess(); } else { WWW req = this.POSTRequest("https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/sentiment", "This is just a test debug string, hopefully I can get some sentiment analysis going."); while (!req.isDone) { } req = this.POSTRequestGeneral("https://woof-api.herokuapp.com/api/conversation", "This is just a test debug string, hopefully I can get some sentiment analysis going.", req.text); while (!req.isDone) { } resultText.text = "RESP: " + req.text; startRecordingButton.enabled = false; } }
void Start() { #if PLATFORM_ANDROID if (!Permission.HasUserAuthorizedPermission(Permission.Microphone)) { Permission.RequestUserPermission(Permission.Microphone); switch (status) { case AuthorizationStatus.Authorized: startRecordingButton.enabled = true; break; default: startRecordingButton.enabled = false; resultText.text = "Cannot use Speech Recognition, authorization status is " + status; break; } } #endif if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); startRecordingButton.enabled = false; SpeechRecognizer.RequestAccess(); } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; startRecordingButton.enabled = false; } }
void Start() { footaudio.Play(); footaudio.mute = true; //collisonaudio.mute = true; /////// //EasyTTSUtil.Initialize (EasyTTSUtil.UnitedStates); //Initialize Speech Recognition if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); SpeechRecognizer.RequestAccess(); } else { resultText = "Sorry, but this device doesn't support speech recognition. Please check permissions."; EasyTTSUtil.SpeechAdd(resultText); } }
void Start() { Screen.orientation = ScreenOrientation.Landscape; modoVibracion = PlayerPrefs.GetString("ModoVibracion"); SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onErrorDuringRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); if (PlayerPrefs.GetString("ModoReconocimiento") == "0") { listener.onPartialResults.AddListener(OnPartialResult); } else { listener.onPartialResults.AddListener(OnPartialResultPalabraClave); } fraseEscena = textoEscena = sceneText.text = "una casa abandonada aparece"; palabrasEscena = textoEscena.Split(' '); cantPalabrasEscena = palabrasEscena.Length; ambienteBosque = GetComponent <AudioSource> (); ambienteBosque.clip = relincho; player.SetActive(true); bosque.SetActive(true); player.gameObject.GetComponent <Animator>().Play("PlayerWalk"); efectoParallax = 1; ActivarEscucha(); imagenNegra.Play("FadeIN"); }