语音和语音识别之间的延迟 [英] Delay between speech and voice recognition

查看:794
本文介绍了语音和语音识别之间的延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加文本到语音和随后的语音识别之间的延迟,但不知道有足够的了解等待/睡眠声明,而不是阻塞主线程的概念。我能有关于如何实现一个等待的建议,直到文本到语音结束口语和语音识别开始。

 字符串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:

http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#setOnUtteranceCompletedListener(android.speech.tts.TextToSpeech.OnUtteranceCompletedListener)

这篇关于语音和语音识别之间的延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆