Increase volume of recording Android AudioRecord

回眸只為那壹抹淺笑 提交于 2019-12-05 01:24:15
Shrish

There is no gain settings in the audioRecord class to play with, so you cannot control the volume of the audio being recorded. The low volume of the audio is related to the hardware and varies from device to device. Here are a few options you can try.

1) try opening in the audio record in different modes and see whats works best . check - http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html

2) in audio record you get the raw PCM buffers. You can write a simple code/function to shift the bits (8/16 bits per channel) left or right to double or halve the gain. (Think of it as a very crude volume control)

3) try searching the net for more complex digital gain techniques for a smoother control. There are many implementations. (There are proprietary techniques as well)

Check: How to adjust microphone sensitivity while recording audio in android

you can also simply increase the volume of the device:

AudioManager am = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);

int previousVolume = am.getStreamVolume(AudioManager.STREAM_MUSIC);
am.setStreamVolume(AudioManager.STREAM_MUSIC, 10, 0);

{... do your things ... } 

am.setStreamVolume(AudioManager.STREAM_MUSIC, previousVolume, 0);

In my case this was an easy fix and it worked with the rest of the application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!