6

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);
nempoBu4
  • 6,521
  • 8
  • 35
  • 40
user1206329
  • 91
  • 1
  • 1
  • 5
  • 1
    did you found any ways to adjust the microphone sensitivity? – Raneez Ahmed Jan 09 '13 at 11:40
  • In my scenario, the speaker volume is correct, but mic volume is very low. Even i tried audiomanager class to increase the volume,but it remains same low volume. please give me a solution. thanks in advance. – Nandhakumar Kittusamy May 08 '17 at 06:43

2 Answers2

2

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);
Ion Aalbers
  • 7,830
  • 3
  • 37
  • 50
  • 3
    thank for you help!But the setStreamVolume function is only useful to spaker,the microphone's volume is alway to hight.I try it hard,but it is not solve so far. – user1206329 Aug 31 '12 at 02:13
0

You can't set the microphone volume using the Android API, only the speaker volume. This is to protect user privacy. If an app could set the microphone volume (say from off to on/high) it could potentially record things you don't want it to have access to. Therefore, you can only adjust the audio output (speaker) volume programmatically, but not the audio input (mic) volume.

Elliptica
  • 3,928
  • 3
  • 37
  • 68