Muting SpeechRecognizer's beep sound

回眸只為那壹抹淺笑 提交于 2019-12-13 01:25:33

问题


I'm using SpeechRecognizer API for my app, and everytime it starts, it plays "beep" sound.

I'd like to know how to mute it, So I could implement one of my own.

Thanks.


回答1:


If you are using a button to activate and deactivate the recognizer you can mute sound onclick. This doesnt work fantastically if you have it listening constantly, however for button clicks it should be fine :)

private AudioManager manager;
manager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    if (isChecked)
    {
        manager.setStreamMute(AudioManager.STREAM_MUSIC, true);
        speech.startListening(recognizerIntent);

    }
    else
    {
        manager.setStreamMute(AudioManager.STREAM_MUSIC, false);
        speech.stopListening();
        speech.cancel();
    }

Hope this helps (sorry if this is abit of a necrothread)



来源:https://stackoverflow.com/questions/24579197/muting-speechrecognizers-beep-sound

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!