问题
I'm using AudioRecord and lame to record mic input to a mp3 sample for 12 seconds. The audio is recorder as expected but I realized the volume is too low.
Is there a way to increase the volume of the recording?
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/26317772/increase-volume-of-recording-android-audiorecord