Superfluous sounds when getting a result in speech recognition.

I found continuous speech recognition on Github Google API Voice, but when the result is displayed or not, the application emits media sounds, tell me how to remove them?

https://github.com/somil55/Android-Continuous-SpeechRecognition

    1 answer 1

    In order to turn off the sounds, you can use the MediaPlayer:

    MediaPlayer mp = MediaPlayer.create(context, R.raw.sound_file_1); 

    and to turn off the sound:

     mp.setVolume(0,0); 

    You can also use AudioManager:

     AudioManager amanager=(AudioManager)getSystemService(Context.AUDIO_SERVICE); amanager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true); amanager.setStreamMute(AudioManager.STREAM_ALARM, true); amanager.setStreamMute(AudioManager.STREAM_MUSIC, true); amanager.setStreamMute(AudioManager.STREAM_RING, true); amanager.setStreamMute(AudioManager.STREAM_SYSTEM, true); 
    • It helped: amanager.setStreamVolume (AudioManager.STREAM_MUSIC, 0, AudioManager.FLAG_SHOW_UI); But it turns off the sound, and the application can not use media. All your listed options did not help. - Sergey Kuntsevich
    • I told you that you can use audiomanager than you used, if you have a working method that solves your problem, you can publish it as an answer :) - Andrew Goroshko
    • He does not suit me - Sergey Kuntsevich
    • so, in my answer, there is an option to disable partially the sounds in the application, that is, roughly speaking, you can choose exactly what you need to leave and the rest turn off, what exactly is the fact that the proposed options do not suit you? - Andrew Goroshko