I have a problem, when I try to record and then play the file that was just recorded. I can both record and play the sound but the quality stinks. Its not just bad is really hard to listen to and sound a bit like its a computer generated voice. I use the andriod SDK-emulator. The code that sets up the recording looks like this;
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 playing the file later looks like this;
MediaPlayer mp = new MediaPlayer();
mp.reset();
mp.setDataSource(path);
mp.prepare();
mp.start();
I don't know what part that makes the audio file sound really bad or if its just the emulator that makes it bad and that it would work on a real phone.
Over on Android, Titanium Recorder (Android only, free with ads) provides one of the most complete solutions for sound capture. Tap the menu button (three dots) on the top right and go to Settings. Here, you can adjust the sample rate, bit rate, and gain to capture as much detail as possible for your recorded audio.
The sound quality of a reproduction or recording depends on a number of factors, including the equipment used to make it, processing and mastering done to the recording, the equipment used to reproduce it, as well as the listening environment used to reproduce it.
Try these
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
recorder.setAudioChannels(2);
recorder.setAudioEncodingBitRate(128);
recorder.setAudioSamplingRate(44100);
Incase if you find this code crash on low end android devices then try removing setAudioChannels and setAudioSamplingRate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With