Increase volume of recording Android AudioRecord
Asked Answered
M

2

13

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?

Mana answered 11/10, 2014 at 18:20 Comment(1)
possible duplicate of How to adjust microphone sensitivity while recording audio in android - SolvedPyrolysis
C
9

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

Cliffhanger answered 23/11, 2014 at 15:29 Comment(0)
M
0

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.

Mennonite answered 26/3, 2018 at 9:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.