Force microphone input in Android

I have a weird setup where I am trying to record audio from an external device using a TRRS audio cable. The way it is supposed to work is I connect the audio cable to the device and then to the phone and then I use AudioRecorder to record to audio. Everything works fine on my HTC One M8 and I can record audio from the device. On my Samsung Galaxy S2, it records audio, but from the internal microphone.

I have confirmed that the problem is with the impedance of the mic input. If I add a resistor to the audio cable to increase the impedance of the microphone, then S2 will record from the device correctly.

So my question is, is there a way to force Android to use an external mic jack? I looked at an ACTION_HEADSET_PLUG request with microphone set to -1 for external, but failing due to permission errors. It seems this intent has been ported to protected permissions ( https://github.com/android/platform_frameworks_base/commit/8f014059d3084fcce9e82b4b1f8b8323744ac52d )

So, is there any other way to get the phone to use the mic jack without external hardware ?!

Thank!

Also, for the actual sound recording, the settings are: Sampling rate 44100 kHz 16-bit samples Mono channel Buffer set to AudioRecord.MinBufferSize ()

+3


source to share





All Articles