Search Issue Tracker

By Design



Found in







Issue ID




[Android] Incorrect values returned from Microphone.GetDeviceCaps



Repro steps:
1. Create a new project
2. Attach the MicPlayback script to a Game Object
3. Build and Run on
4. Obser the device's log

Actual: Microphone.GetDeviceCaps returns min and max 16000 or 0 on iOS even though you can successfully use a different frequency

Reproducible with: 2018.4.28f1, 2019.4.17f1, 2020.1.17f1, 2020.2.0f1, 2021.1.0b1

Tested and reproduced on these devices:
VLNQA00001, Google Pixel 2 (Pixel 2), Android 11, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00275, Oculus Quest (Quest), Android 7.1.1, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
----------, Oculus (Quest 2), Android 10, CPU: NOT FOUND, GPU: Adreno (TM) 650
VLNQA00231, Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76
----------, Oneplus OnePlus 6 (ONEPLUS A6003), Android 10, CPU: Snapdragon 845 SDM845, GPU: Adreno (TM) 630
iPhone 11 (iOS 13.5)

Didn't reproduce on:
VLNQA00331, Huawei P20 lite (ANE-LX1), Android 9, CPU: HiSilicon Kirin 659, GPU: Mali-T830

  1. Resolution Note (2021.2.X):

    Going through implementation it seems we return a hardcoded frequency and ignore the passed one when starting the recording.
    I can't quickly find Android API to get the supported values.
    In any case, adding support for this would be a a feature.

Comments (4)

  1. funkyCoty

    Oct 19, 2023 20:08

    What an absolutely insane reply.

  2. jhughes2112

    Aug 24, 2023 20:39

    This is still an issue even on PC for certain very common headset microphones, such as Beats and Sennheiser PXC550, and probably many others (perhaps all bluetooth?). They report as 16000 and are actually recording at 48000, which makes it nearly impossible to write proper microphone input handling.

    Fix it.

  3. achimmihca

    Nov 01, 2021 17:46

    What the fluff ?!
    "By Design" the resolution says?

    The API reference says: "Get the frequency capabilities of a device."

    I strongly disagree that returning a hard coded value of 16000 is true to this statement.
    At least you could tell truth in the documentation and say that it returns this value (aka. garbage) on some mobile devices.
    You know, this would save developers time because they don't have debug their own code when the real issue is on Unity side.

    Obviously this issue will not be fixed anymore, since it is already years old. Rafael_CS already found code to get the proper value for Android. If you gave some dev on your team the time, I am sure this could be fixed easily. But it is not a priority as it seems.

    I understand that Unity is a very complex software with lots of different branches, areas, customers, and money involved.

    But here, you are just lying developers in the face and saying its "by design".
    The result is a loss of trust in the Unity platform, because it is a buggy, unpredictable mess with false documentation.

    > "In any case, adding support for this would be a a feature."

    Why not fix the documentation then? It is currently saying, that exactly this "feature" works.

    > This is freaking insane that Unity closed this issue because don't understand Android SDK

    I agree. Except, the original bug was for iOS, which this only makes it worse...

    Unity: Ignorant "By Design".

  4. Rafael_CS

    Jun 21, 2021 04:19

    "Can't find Android API to get supported values".. .really?

    this simple code above can handle this

    public void GetValidSampleRates() {
    for (int rate : new int[] {8000, 11025, 16000, 22050, 44100, 48000}) { // add the rates you wish to check against
    int bufferSize = AudioRecord.getMinBufferSize(rate, AudioFormat.CHANNEL_CONFIGURATION_DEFAULT, AudioFormat.ENCODING_PCM_16BIT);
    if (bufferSize > 0) {
    // buffer size is valid, Sample rate supported


    I think unity needs to stop closing issues that were not solved...

    This is freaking insane that Unity closed this issue because don't understand Android SDK... lol

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.