Change Android default audio recording

I am currently writing an application that requires real-time recording and processing of audio data. For this, I use the AudioRecord class. This works well and well, except that by default, the back speaker is recorded to record sound on my primary testing device, the galactic nexus. I assume that most default recording phones will be rear or bottom microphones by default, because when you use the phone for a call, your mouth is at the base.

However, my application requires recording from the speaker on the front of the phone, and so I was hoping someone could help me on how to programmatically change the AudioRecord input source. I searched extensively for the answer to this question.

Some of the things I reviewed are as follows:

Using the AudioManager class and turning on the speaker, for example:
AudioManager am = (AudioManager) getSystemService (Context.AUDIO_SERVICE);
am.setSpeakerphoneOn (true);

Changing the AudioSource parameter when building my AudioRecord object:
AudioRecord ar = new AudioRecord (AudioSource. ????, ..., ..., ..., ...);

I found that the API is not too specific as to which AudioSource formats are there, so I was wondering if anyone else struggled with this problem and could point me in the right direction.

Thanks in advance,

+5
1

Android , , . , , , . AudioRecord , :

AudioRecord ar = new AudioRecord(AudioSource.MIC, ..., ..., ..., ...);

.

0

All Articles