How To Mute Or Remove The Beep Sound Of Continuous Running SpeechRecognizer In A Service?

I have a SpeechRecognizer running in a Service which runs continuously and open up the app when the user says a predefined keyword for eg. 'Ok Google', And to not to annoy the user I mute the beep sound by using this technique

  mAudioManager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true);
            mAudioManager.setStreamMute(AudioManager.STREAM_ALARM, true);
            mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, true);
            mAudioManager.setStreamMute(AudioManager.STREAM_RING, true);
            mAudioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true);

Well, it works perfectly fine until user plays any sound for eg. Music or Youtube because these apps need the sound stream to be un-muted which was stopping the beep sound of the SpeechRecognizer. So I tried this link But I did not get where to use these codes as the answer was not explained. Please Help Me, Is There Any Alternative?