How to adjust microphone volume in android?
26,970
When the microphone is open, it used the volume of the AudioManager.STREAM_MUSIC.
Try to increase this volume and check if the microphone volume also increased.
With:
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
am.setStreamVolume(AudioManager.STREAM_MUSIC, yourVolume, 0);
Author by
Admin
Updated on April 06, 2020Comments
-
Admin about 4 years
I want to recorder the sound, but the mic (microphone) input sound is too loud, and I want to adjust the mic volume, would someone help me? The following 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);