I am currently writing an app that calls for the recording and real time processing of audio data. For this, I am using the AudioRecord class. This works all well and good, except the default setting for recording audio on my primary testing device, a galaxy nexus, is to record from the back speaker. I am assuming most phones default record source will be the back, or bottom microphones, because when you are using the phone to call, your mouth is near the bottom.
However, my app requires that I record from the speaker on the front of the phone, and so I was hoping someone could help me with how to change the AudioRecord input source programmatically. I have searched extensively for the answer to this.
Some things I have considered are:
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE); am.setSpeakerphoneOn(true);
AudioRecord ar = new AudioRecord(AudioSource.????, ..., ..., ..., ...);
I have found that the API's are not too specific about which AudioSource formats are which, so I was wondering if anyone else has struggled with this issue and could point me in the right direction.
Thanks in advance,
Android does not currently support call recording, so I believe you can't change it to record from the earpiece. You shouldn't really need to however, the Mic at the bottom of the phone should be able to record things to the full capacity you need. To set the AudioRecord to the mic, just do:
AudioRecord ar = new AudioRecord(AudioSource.MIC, ..., ..., ..., ...);
This will give you the best recording quality.