gpt4 book ai didi

android - 我可以让语音识别器无限期地收听吗?

转载 作者:IT老高 更新时间:2023-10-28 23:13:05 41 4
gpt4 key购买 nike

当我调用 SpeechRecognizer 对象的 startListening 方法时,语音识别器开始监听语音。我想创建一个等待特定关键字语音的服务:当用户说出这个关键字并且语音识别器检测到这个关键字时,服务就准备好接收用户语音命令。

为此,在一个新的 SpeechRecognizer 实例化后,我应该调用它的 startListening 方法:我可以让语音识别器无限期地听吗?

最佳答案

Android 语音识别器 可以通过 Intent 额外数据进行自定义。见 the android documentation .

public static final String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS

The amount of time that it should take after we stop hearing speech to consider the input complete. [...]

public static final String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS Since: API Level 8

The minimum length of an utterance. We will not stop recording before this amount of time. [...]

public static final String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS

The amount of time that it should take after we stop hearing speech to consider the input possibly complete. [...]

设置EXTRA_LANGUAGE_MODEL到网络搜索以仅捕获相关词。

关于android - 我可以让语音识别器无限期地收听吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10182893/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com