I want to build a app where I want to modulate the sound in a call.I have written a code that record the sound nd play it in different pitch.Now I want this feature while calling.I want to mute the call record the sound then play it with diff pitch.How to mute the call but still record the audio.
This answer works to mute your microphone during a call:
Boolean isMuted = false;
Then in your event, say an onClick
AudioManager audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
if(!isMuted){
if((audioManager.getMode()== AudioManager.MODE_IN_CALL)||(audioManager.getMode()== AudioManager.MODE_IN_COMMUNICATION)){
audioManager.setMicrophoneMute(true);
}
isMuted = true;
}else{
if((audioManager.getMode()== AudioManager.MODE_IN_CALL)||(audioManager.getMode()== AudioManager.MODE_IN_COMMUNICATION)){
audioManager.setMicrophoneMute(false);
}
isMuted = false;
}
Remember to enable permissions in your manifest:
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With