androidandroid-mediarecorderamrbit-depth

Android MediaRecorder: How to set bit depth?


I need to record audio and save the file in amr format use Android MediaRecorder.
The file info what i get like this.

General
Complete name                    : E:\11-09-05-40-29.amr
Format                           : AMR
Format/Info                      : Adaptive Multi-Rate
File size                        : 2.69 KiB
Duration                         : 1s 720ms
Overall bit rate                 : 12.8 Kbps

Audio
Format                           : AMR
Format/Info                      : Adaptive Multi-Rate
Format profile                   : Narrow band
Duration                         : 1s 720ms
Bit rate mode                    : Constant
Bit rate                         : 12.8 Kbps
Channel(s)                       : 1 channel
Sampling rate                    : 8 000 Hz
Bit depth                        : 13 bits
Stream size                      : 2.69 KiB (100%)

This is my code

mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);      
mMediaRecorder.setAudioEncodingBitRate(16);
mMediaRecorder.setAudioChannels(1);
mMediaRecorder.setAudioSamplingRate(8000);

But I need to change it Bit depth to 16 bits , what should I do ?
Thanks for first.


Solution

  • I'm not sure, but seems You can't change it within MediaRecorder.AudioEncoder.AMR_NB because

    Bit rate = (sampling rate) × (bit depth) × (number of channels)

    where sampling rate and number of channels are fixed, but AMR (Adaptive multi rate) means variable Bit rate. So, I think You can see "average" bit depth. You can change it by using other encoding and media formats (for example PCM-16 bit).