// A thread to try and retry to connect at least 10 times. Seems to be needed on Android. public IEnumerator startListening() { bool listening = false; int tries = 0; tries++; listening = m_SpeechToText.StartListening(OnRecognize); if (listening || tries == 10) { yield break; } else { yield return(null); } }
public void StartTalking() { if (!_speechToText.IsListening) { _playBackAudioData = new List <float>(); _audioChunkStartPosition = Microphone.GetPosition(Microphone.devices[0]); // cancel the timeout if user starts speaking if (_stopListeningTimeoutCoroutine != null) { StopCoroutine(_stopListeningTimeoutCoroutine); } _speechToText.StartListening(OnSpeechRecognize); _pushAudioChunkCroutine = StartCoroutine(PushAudioChunkCroutine()); _stopListeningTimeoutCoroutine = StartCoroutine(StopTalkingTimeout(InactivityTimeoutSec)); } }
public void MicrophoneStartListen() { _service.StartListening(OnRecognize, OnRecognizeSpeaker); }