语音和语音识别之间的延迟 [英] Delay between speech and voice recognition
问题描述
我想添加文本到语音和随后的语音识别之间的延迟,但不知道有足够的了解等待/睡眠声明,而不是阻塞主线程的概念。我能有关于如何实现一个等待的建议,直到文本到语音结束口语和语音识别开始。
字符串myText1 =请讲新的车速限制;
mTts.speak(myText1,TextToSpeech.QUEUE_FLUSH,NULL);
speechSucess = TRUE;
startVoiceRecognitionActivity();
设置 OnUtteranceCompletedListener
并调用 startVoiceRecognitionActivity();
从听者的回调函数:
<一个href=\"http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#setOnUtteranceCompletedListener(android.speech.tts.TextToSpeech.OnUtteranceCompletedListener\" rel=\"nofollow\">http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#setOnUtteranceCompletedListener(android.speech.tts.TextToSpeech.OnUtteranceCompletedListener)
I'd like to add a delay between the text to speech and the subsequent voice recognition but don't know enough about wait/sleep statements and the concept of not blocking the main thread. Could I have suggestions on how to achieve a wait until the text to speech is finished speaking and the voice recognition starting.
String myText1 = "Please speak the new speedlimit";
mTts.speak(myText1, TextToSpeech.QUEUE_FLUSH, null);
speechSucess = true;
startVoiceRecognitionActivity();
Set an OnUtteranceCompletedListener
and call startVoiceRecognitionActivity();
from the listener's callback function:
这篇关于语音和语音识别之间的延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!