Recording stereo with AudioRecord in Android

I'm looking for a definitive answer to getting audio recordings to use both top-mounted and bottom-mounted microphones, so I don't have two identical (mono) channels. I would like to know what kind of poll I could do before the gadget provides a good flow.

I am working on galaxy nexus 5 and cannot get it to work, so I am not sure if it is stable on all devices.

I've tried everything MediaRecorder.AudioSource

.

AudioRecord audioInputStream1 = new AudioRecord(Media.Recorder.CAMCORDER,
    sampleRate, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT,
    samplesPerBuffer * bytesPerSample)

      

and also creating two records:

AudioRecord audioInputStream1 = new AudioRecord(Media.Recorder.MIC,
    sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT,
    samplesPerBuffer * bytesPerSample)

AudioRecord audioInputStream2 = new AudioRecord(Media.Recorder.CAMCORDER,
    sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT,
    samplesPerBuffer * bytesPerSample)

      

If anyone could get a stereo recording on Bundle 5, I would be very grateful for your help. Should I go to alsa or tinyAlsa?

thanks, J

+3


source to share


1 answer


Your question is closely related to my question , and it seems that the answer is device dependent:

1) For some devices (for example, Samsung S2 Plus GT-I9105P, HTC One M7, HTC One M8, G3 LG-D855, Nexus 5, ...) there is simply no way to activate real stereo recordings through the built-in microphone capsules. While in some cases the manufacturer's video camera app produces a real stereo system, you won't find another app that can do this.

2) For some other devices, only a few specific combinations MediaRecorder.AudioSource

and, for example, the sampling rate (or other basic settings) allows for real stereo recording (for example, the Motorola Moto G also requires MediaRecorder.AudioSource.CAMCORDER

a sampling rate of 48 kHz
).



3) On most devices with two microphone capsules, it is AudioFormat.CHANNEL_IN_STEREO

enough to activate real stereo recording.

Unfortunately, Alsa or tinyAlsa most likely won't fix the problem without rooting the device.

+4


source







All Articles