问题描述
我已经在应用中实现了基于 android demo 的 VOSK。目前,在收听输入时,麦克风会保持打开状态 5 秒钟,然后评估输入。我需要麦克风保持打开状态更长时间,即 10 秒。以下暂定对其没有影响。
private void startSttService(SingleEmitter<String> emitter,Bundle extras) {
float sampleRate = 16000.0f;
KaldiRecognizer rec;
if (Objects.nonNull(extras) && extras.containsKey(EXTRA_GRAMMAR)) {
rec = new KaldiRecognizer(VoskModel.getModel(),sampleRate,extras.getString(EXTRA_GRAMMAR));
} else {
rec = new KaldiRecognizer(VoskModel.getModel(),sampleRate);
}
int speechServiceTimeout;
if (Objects.nonNull(extras) && extras.containsKey(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS)) {
speechServiceTimeout = (int) extras.getLong(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS);
} else {
speechServiceTimeout = 10000;
}
帮助:(
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)