谷歌语音搜索从您通过 startActivityForResult() 调用它的那一刻起,直到它的对话框显示,准备好接受您的演讲,都会有很大的延迟。
这要求用户在说话之前总是看着屏幕,等待对话框显示出来。
因此,我正在考虑通过实现 RecognitionListener 并在 onReadyForSpeech() 中发出 DTMF 音来生成可听信号而不是对话框,如下面的片段:
@Override
public void onReadyForSpeech(Bundle params) {
Log.d(LCTAG, "Called when the endpointer is ready for the user to start speaking.");
mToneGenerator.startTone(ToneGenerator.TONE_DTMF_1);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
Log.e(LCTAG, "InterruptedException while in Thread.sleep(50).");
e.printStackTrace();
} // SystemClock.sleep(50);
mToneGenerator.stopTone();
}
音调听起来很美,但是......它也被麦克风“听到”,到达语音识别服务并总是产生识别错误ERROR_NO_MATCH。
有没有办法解决这个问题?