How to adjust the microphone volume in Android?

I want to record a sound, but the microphone (microphone) sound is too loud and I want to adjust the microphone volume, can someone help me? Below is the main code:

private int audioSource = MediaRecorder.AudioSource.MIC;

private static int sampleRateInHz = 8000;

private static int channelConfig = AudioFormat.CHANNEL_CONFIGURATION_MONO;

private static int audioFormat = AudioFormat.ENCODING_PCM_16BIT;

audioRecord = new AudioRecord(audioSource, sampleRateInHz,channelConfig, audioFormat, bufferSizeInBytes);
audioManager.setSpeakerphoneOn(false);
+5
source share
1 answer

When the microphone is open, it used the AudioManager.STREAM_MUSIC volume .

Try increasing the volume and see if the microphone volume has increased.

WITH

AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
am.setStreamVolume(AudioManager.STREAM_MUSIC, yourVolume, 0);
+2
source

All Articles