Is Microphone sensitivity and sound measure for loudspeaker adjustable in android? If it can be , how can i do that (with which classes and methods)?
And how can i stimulate a phone call and send message when a little sound comes to phone?
For API 16 you can use AutomaticGainControl, the AudioEffect and the AudioRecord to adjust gain, sampling and other pre-processing audio recording features.
Related
I'm building video chat application. During the call only one side audio is clear and other side its feeble and quiet. I want to increase the gain of microphone on the device so that the voice is clearly audible at other side.
Can any one tell me how to increase the Microphone gain programatically in android?
More specifically which API should I use for this?
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.
I am working on an Android project in which I want the same functionality as the Android native audio recorder. Specifically the sound quality option. I can't use the native recorder, so I'm recording audio using the AudioRecord class. How do I process the data coming from the AudioRecord class for the quality? Application has three quality defined which I need to implement:
Low - records will have only high pitch sounds,
Medium - records will have some of background sound,
High - everything that reaches at microphone Will be Recorded.
Please suggest some way to do it.
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?
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.
We are developing a VOIP application, there is one component which need to record the audio from mic, and play the remote audio to speaker. And we need to do some audio/signal processing for the recorded audio.
But on some android device, the selected mic and speaker is so near, the audio captured from MIC clipping (too loud) because of the audio played by speaker. This cause the captured audio waveform have nonlinear losses, and make the audio/signal processing component doesn't work.
We doesn't want to set AUDIO_STREAM_VOICE_CALL to enable build-in AEC, because it will make the recorded audio sample rate to be 8k while I'd like the recorded audio to be 48k.
So We have consider following solution:
Decrease the mic volume. Base on this SO question and this discussion thread, it seams impossible.
Using specific speaker and mic to make the distance a little bit far, so the mic captured audio volume is low.
So any way to select specific speaker on android platform?
If the distance between microphone and the speaker is crucial here maybe is would be enough to use camera's mic:
MediaRecorder.AudioSource.CAMCORDER
Is it possible to change the sampling rate while recording an Audio in Android using AudioRecord or MediaRecorder?
Both of these class requires to initialize first the sampling rates before recording an Audio, But I was wondering if I can change the sampling rate, let's say 8000 to 16000 and vis-a-vis, in the middle of recording.
What would you expect to happen when you change the sampling rate once it is recording? Setting the rate directly is not supported by AudioRecord, so that is a definite no.
Setting the rate directly with MediaRecorder is allowed, but is expected to be done before starting the recording. I would not expect all, if any, implementations of the Android OS to handle this.