android - RecognitionListener.onReadyForSpeech() 中的 DTMF 音被误认为是语音

标签 android speech-recognition voice-recognition

从您通过 startActivityForResult() 调用它到它的对话框显示准备好接受您的演讲,Google 语音搜索会出现明显的延迟。

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

所以我正在考虑通过实现 RecognitionListener 并在 onReadyForSpeech() 中发出 DTMF 音调来生成声音信号而不是对话框,如下面的代码 fragment 所示:

  @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

有没有办法解决这个问题?

最佳答案

这是一个随机的想法,它很可能行不通。

您可以尝试在播放音调时禁用麦克风(可能通过 AudioManager.setMicrophoneMute)吗?

关于android - RecognitionListener.onReadyForSpeech() 中的 DTMF 音被误认为是语音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5734555/

相关文章:

web-services - 语音识别(网络)服务?

javascript - SpeechRecognition 在 Firefox 中不起作用

python - 语音队列寻找句子中口语单词的重复部分

android - 在 Android 中的 Textview 上剪切复制粘贴

java - Android - 饼图

安卓 API21 : VoiceInteractionService onReady() not called

android - 玻璃 GDk : Contextual voice commands without the "Ok Glass"

Android以不同方式识别2个人的声音

android - 如何在 Android 的 GridView 中集中最后一个不均匀的行?

java - 无法在 int[] 上设置数字