在RecognitionListener.onReadyForSpeech()DTMF音误认为是演讲RecognitionListener、onReadyForSpeech、DTMF

由网友(孤独的像条狗)分享简介:谷歌语音搜索来与您通过startActivityForResult()调用它,直到它的对话框中显示的那一刻起显著的延迟,愿意回答大家的发言。The Google Voice Search comes with a significant delay from the moment you call it via st...

谷歌语音搜索来与您通过startActivityForResult()调用它,直到它的对话框中显示的那一刻起显著的延迟,愿意回答大家的发言。

The Google Voice Search comes with a significant delay from the moment you call it via startActivityForResult() until its dialog box is displayed, ready to take your speech.

这需要用户始终看屏幕,等待对话框显示,说话前。

This requires the user to always look at the screen, waiting for the dialog box to be displayed, before speaking.

所以,我想通过实施RecognitionListener和探空在onReadyForSpeech()DTMF音频如下面的代码片段生成音频信号,而不是对话框:

So I was thinking of generating an audible signal instead of the dialog box by implementing RecognitionListener and sounding a DTMF tone in onReadyForSpeech() as in the following snippet:

  @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 。

The tone sounds beautifully but... it is also "heard" by the microphone, arriving to the voice recognition service and always generating a recognition error ERROR_NO_MATCH.

有没有办法来解决此问题?

Is there a way to work around this?

推荐答案

下面是一个随机的想法,它很可能无法正常工作。

Here is a random idea, and it may very well not work.

你能尝试禁用麦克风(也许通过 AudioManager.setMicrophoneMute ),而提示音?

Can you try disabling the microphone (maybe via AudioManager.setMicrophoneMute) while the tone is played?

阅读全文

相关推荐

最新文章