Bruno Arantes Bueno
Bruno Arantes Bueno

Reputation: 201

How to select physical microphone and audio recording path in Android

I'm developing an app that records audio input from the device's microphone(s). We'd like to record unprocessed/raw audio (i.e. with no effects applied like noise suppression or automatic gain control) and also give users the option to specify which microphone (e.g. top, front, back, etc.) to use for recording.

According to Android documentation, the only way to get an input audio stream that's guaranteed to be unprocessed is by selecting VOICE_RECOGNITION on setAudioSource()

That said, what would be the correct way to choose the physical microphone to use?

In more recent API levels, there are the following methods that seem to allow for the selection of specific microphones:

Does anybody know how to achieve my goals, i.e. get unprocessed audio input while also specifying the physical microphone to use?

Upvotes: 3

Views: 3062

Answers (2)

Style-7
Style-7

Reputation: 1226

Starting API 29 you can use method AudioRecord.setPreferredMicrophoneDirection including MicrophoneDirection.MIC_DIRECTION_EXTERNAL.

Upvotes: 0

Jerome
Jerome

Reputation: 1281

The microphone selection is done with MediaRecorder.AudioSource.MIC (front) / MediaRecorder.AudioSource.CAMCORDER (back) / MediaRecorder.AudioSource.DEFAULT (default).

VOICE_RECOGNITION is used to enable/disable AGC but can only be used with the front microphone (MediaRecorder.AudioSource.MIC).

Upvotes: 1

Related Questions