javaandroidvoice-recording

How to improve the android recorded voice quality


I have the following code for recording audio/voice in android:

MediaRecorder recorder=new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioEncodingBitRate(16);
recorder.setAudioSamplingRate(44100);
recorder.setOutputFile(Environment.getExternalStorageDirectory() + File.separator
                    + Environment.DIRECTORY_DCIM + File.separator + "WAVES.amr");

try {
       recorder.prepare();
       recorder.start();
} catch (IOException e) {
       Toast.makeText(topic_player_list_layout.this,"Unable to record",Toast.LENGTH_SHORT).show();
       return;
            }


The question is that the output of recorded audio file quality is not good as compared to default android voice recorder app or whatsApp/Telegram voice recorder.

What do you suggest? What can I do to improve the quality of recorded voices?


Solution

  • You have to increase your audioEncodingBitRate

    MediaRecorder recorder=new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setAudioEncodingBitRate(128000);
    recorder.setAudioSamplingRate(44100);