I will describe briefly my trouble with audio recording.
So, I am doing audio recording using MediaRecorder, but unfortunately when I playback the recorded audio, I have media with a very low volume. I hardly hear anything.
Is there any possibility to setup recording volume?
Thanks.
I experienced this issue on the Nexus One while using Froyo when the AudioManager was set to MODE_IN_CALL. Try setting it to MODE_NORMAL. This fixed the problem for me.
AudioManager audioManager = (AudioManager)activity.getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_NORMAL);
There is no way to do this while recording - but while playing, you can use the setVolume(float, float) method on MediaPlayer.
Related
Android AudioManager and output is quite difficult to understand. I am checking AudioManager api and also search for some explanation. But the scenario i want is not working the way i want.
I have the local downloaded audio file. First I play them as STREAM_MUSIC. So the sound will output to the phone speaker and when earphone plugged in, it will played through the earphone.
But i was requested to output the audio file to handset instead of the speaker.
There is no easy way to change it. I set audioManager.setSpeakerPhoneOn(false), the audio is still playing output through the speaker.
So after studying, i modified as below:
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.requestAudioFocus(mFocusChangeListener, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
audioManager.setSpeakerphoneOn(false);
By changing the audioManager mode to MODE_IN_COMMUNICATION (like the phone call), the audio file is finally output to handset. But when i plugged in the earphone, i didn't hear sound from the earphone, and i don't find the api to set the output route to handset manually in the AudioManager.
Any suggestion?
Can anybody explain me what's the difference between AudioManager and MediaPlayer in Android ? If I am correct, then AudioManager can only play audio, while MediaPlayer can play both audio and video. But I believe there must be more to this.
Thanks.
AudioManager doesn't play sound at all. It provides access to sound settings, but to play sounds easily, you should use MediaPlayer, SoundPool, or possibly AudioTrack.
From the docs:
AudioManager provides access to volume and ringer mode control.
AudioManager is used to manage audio settings. This includes volume control and the streaming channels (e.g. ringer, media, in-call, etc.).
MediaPlayer is used for controlling the playback (e.g. stop, play, pause, etc.) of audio/video streams.
I'm not that familiar with android programming and would like to set the audio volume while (or before) recording a video with MediaRecorder. Is there a way to do that? Or is there a better way to record a video with variable audio volume, instead of using MediaRecorder?
There is no way to set volume while recording using MediaRecorder. But you can set volume while playing using MediaPlayer by using the method setVolume(float, float)
I am doing audio recording using MediaRecorder, but unfortunately when I playback the recorded audio, I have media with a very low volume. I don't hear anything (almost anything).
Is there any possibility to increase recording volume? Like setVolume() when we record?
I try to see in MediaRecorder API but i can't find setVolume or something like that..
Is there any work around?
Thanks.
Well after some r&d and googling i found is there is no specific volume for mic. when you are recording that takes media volume as mic volume.
So to set it, Goto
Settings->Sound->Volume->
and check Media volume.
If you wan to Record in the full Volume then keep Media Volume high and if you want to record in low Volume then keep Media Volume Small.
AIK there is no other sollution.
So please do it for your case.
I want to make an app to record using MediaRecorder with certain volume set by user.
Is there any possibility to set the volume when recording? I try to see in MediaRecorder API but i can't find setVolume or something like that..
Is there any work around? Or any post process that i have to do to make it happen?
Thanks.
You can not do it while recording, but you can set the volume while playing with the setVolume(float, float) method on MediaPlayer.