Wrong microphone max frequency (sample rate) on Android

I am reading microphone capabilities of my Galaxy S10e using

Microphone.GetDeviceCaps(deviceName, out int minFreq, out int maxFreq);

For every deviceName I get 16000 for both minFreq and maxFreq. I get the device name from Microphone.devices.

These values are wrong. The mic should be able to record at 48000 Hz.
I also checked this using this app: https://play.google.com/store/apps/details?id=br.com.vixti.samplerate

Question:

  • is Unity’s access to Android’s mic limited, such that Unity is unable to record with more than 16000 Hz?
  • is there maybe a Player Setting or Project Setting that I can change to fix this?

My Unity version is 2021.2.0f1

This is a known issue, with an existing, closed bug report but no fix: Unity Issue Tracker - [Android] Incorrect values returned from Microphone.GetDeviceCaps

Looks like it also affects iOS devices.

In this case, I would say the documentation is lying.
It should say: “Get the frequency capabilities of a device… on some platforms… on some others, a hard coded value of 16000 is returned”.

Wow Unity!

This is actually still an issue on PC for a number of headsets (Beats and Sennheiser PXC550 at least). Very disappointing.

Hi anyone faced this issue ?

AudioClip audioClip = AudioClip.Create(fileName, samplesData.Length, clip.channels, 16000, false);
audioClip.SetData(samplesData, 0);

i am creating audio clip by recording voice and i want to create audio clip with 16000 sample rate. In android is working fine but for webgl its not working. when i upload build and test in browser its always creating audio clip with 44100 sample rate