//This is related to the Speech to Text void Update() { if (listening) { //Verify if the 2 condition to stop listening are there if (cooldownSTT >= limitSTT && !String.IsNullOrEmpty(savedLineSTT)) { STTstreamer.StopRecording(); string tempString = lineSTT.Trim(Environment.NewLine.ToCharArray()); associatedLogControl.LogText(tempString, new Color(252f / 255, 161f / 255, 157f / 255)); SendLineAssistant(tempString); savedLineSTT = ""; lineSTT = ""; listening = false; finishedListening = true; }//Add 1 (time period) if the 2 texts are equal if (lineSTT == savedLineSTT) { cooldownSTT += Time.deltaTime; } else//Otherwise, reset time and copy the line from the STT to the line saved. { cooldownSTT = 0f; savedLineSTT = lineSTT; } if (!STTstreamer.Active && cooldownSTT > 2f) { STTstreamer = new ExampleStreaming(); STTstreamer.SetServiceFromWrapper(stt); STTstreamer.StartRecording(); cooldownSTT = 0f; } } }
private void OnEnable() { if (ExampleStreaming.isComplete) { SpeechToTextManager.StopRecording(); getDataFromNLP(); } }