I have a problem when I try to record and then play the file that was just recorded. I can record and play sound, but the quality stinks. Its not just bad, itβs very difficult to listen to and a bit like a computerβs voice. I am using andriod SDK emulator. The code that sets up the entry is as follows:
MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(path); recorder.prepare(); recorder.start();
And the code that plays the file later looks like this:
MediaPlayer mp = new MediaPlayer(); mp.reset(); mp.setDataSource(path); mp.prepare(); mp.start();
I donβt know which part makes the audio file sound really bad, or if only its emulator does it badly and that it will work on a real phone.
android android-emulator audiorecord
Nick3
source share