How to access the second mic android such as Galaxy 3

18,555

I'm not familiar with the Galaxy S3 specifically, but the following is true for the majority of devices I've worked with:

  • There's no reliable way of selecting whether to use the primary or secondary mic for a mono recording. The MIC AudioSource usually means the primary mic when doing a mono recording, and the CAMCORDER source might mean the secondary mic. But there's no guarantee for this, because it depends e.g. on the physical placement of the mics.

  • Recording in mono effectively turns the other mic off, and whatever noise reduction is done uses only the signal from one mic (so there's little to no reduction of dynamic noise).
    One exception to this might be if you record during a voice call where both mics already have been enabled in order to do uplink noise suppression.
    Another exception might be if you use the VOICE_RECOGNITION AudioSource, because some vendors apply noise suppression on the signal using one or more extra mics in this use-case.

  • Recording in stereo records from both mics on a 2-mic device. The left channel contains the input from one mic and the right channel contains the input from the other mic, but there's no guarantee as to which physical mic the channels correspond to (again, depends on the placement).

Share:
18,555
Foreverniu
Author by

Foreverniu

Updated on July 19, 2022

Comments

  • Foreverniu
    Foreverniu almost 2 years

    A lot of smart phone now have more than one microphone. One for voice input and another for reducing the enviroment noise.

    I am wondering how could I access the two microphone's signal independently? Or turn off one of the microphone?

    Any thoughts or comments are welcomed. Thanks a lot.

  • Foreverniu
    Foreverniu about 11 years
    Thanks. I think your response is great. I just have one additional question: If I use the stereo records, like ENCODING_PCM_16BIT, do you know how to separate each channel's signal out? I use audiorecord to get the signal out from android. Really appreciate your help.
  • Michael
    Michael about 11 years
    PCM_16BIT only affects the resolution of each sample. To get stereo you should request two channels for the recording. To separate the channels, simply read alternate samples from the PCM stream (assuming that you're using the AudioRecord class). That is, offsets 0,2,4,6... in your short[] contain the left channel samples, and offsets 1,3,5,7... contain the right channel samples.
  • Foreverniu
    Foreverniu about 11 years
    Your answer is awesome. Just a confirmation: To require a two channels for the recording, does the code below is right? recorder = new AudioRecord(AudioSource.MIC, iSampleRate, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT, iAudioBufferSize); Thanks.