Android 语音识别与 Text to Speech 冲突 [英] Android speech recognition conflicting with Text to Speech

查看:47
本文介绍了Android 语音识别与 Text to Speech 冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经根据此处给出的方法在我的应用程序中实现了连续语音识别:Android 语音识别持续服务.它本身工作得相当好.

I have implemented continuous speech recognition in my app based on the method given here: Android Speech Recognition Continuous Service. It works reasonably well by itself.

但是,我想实现一个功能,应用程序正在使用文本到语音阅读网页,并且在阅读过程中,我想打开语音识别,以便我可以要求它停止使用语音.但是,我看到语音识别也开始识别文本到语音输出.有什么方法可以让它忽略手机发出的声音,只识别我在麦克风里说的话.

However, I want to implement a feature where the app is reading a web page using Text To Speech and during the reading is going on, I want to have the speech recognition turned on so that i can ask it to stop using voice. However, I am seeing that the speech recognition starts recognition the Text to Speech output as well. Is there a way by which I can make it ignore the sounds coming out of the phone and only recognize what I say in the microphone.

推荐答案

您可以做的是在段落之间进行短暂的停顿,并在停顿期间听取用户的命令.要实现它,您需要使用 UtteranceProgressListener.说一段话,然后在 onDone 中打开语音识别器.设置倒数计时器并onFinish关闭语音识别器并阅读下一段.

What you can do is having a short pause between paragraphs and listen to user commands during this pause. To implement it you need to use UtteranceProgressListener. Speak a paragraph and then in onDone turn on the speech recognizer. Set a countdown timer and onFinish turn off the speech recognizer and read the next paragraph.

这篇关于Android 语音识别与 Text to Speech 冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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