Describe your suggested feature
Currently when sample rate is configured to auto default sample rate and default encoding bitrate is used for the actual recording.
When disabling auto and entering sample rate value manually it may not fully respect that configuration.
On my device Xiaomi Redmi 9 with Android 12 AOSP it's working like this:
When configuring recording format to opus, sample rate to auto, the resulting recording is samplet at 48 kHz with audio bitrate about 32 kbps.
When configuring recording format to opus, sample rate to 44100, resulting recording is sampled at 48 kHz with audio bitrate about 280 kbps. The system encoder won't apparently accept any value for opus codec than the default. I have tried 44100 and 16000 so far. The bitrate 280 for 48 kHz recording is an overkill I think. The opus codec is tuned for low bitrates and I'd prefer 32 kbps or 40 kbps bitrate for casual recordings, up to 128 kbps for high quality recordings.
When configuring recording format to AAC, sample rate to 16000, the resulting AAC file is sampled at 16000 Hz with audio bitrate 96 kbps thus it's not accepting very high bitrate of 16000 *32 *2 at all.
Most likelly the best way to move forward would be to add an ability to configure bitrate and number of audio channels too so we would be able to make stereo recordings. Now many devices do support stereo recording.
Consider using HE_AAC encoder as it supports higher quality recording than AAC.
Also for stereo recordings without applying the default compression and limiter processing it would be nice to configure recording source. This is device specific but I think at least these should be selectable:
MediaRecorder.AudioSource.DEFAULT, MediaRecorder.AudioSource.MIC, MediaRecorder.AudioSource.CAMCORDER, MediaRecorder.AudioSource.UNPROCESSED,
Since API 29 there are some new microphone related settings. I haven't seen a device which I might be able to make some good use out of with but that might become important in the future as well.
Other details
I might be able to work on this however I'd like to know your opinion on this first.
Acknowledgements