How can i record M4A audio file with MediaRecorder in Android 2.2 ?
What output format, encoder and sampling rate i need to set ?
I need to record it from microphone and save it in SDCARD
UPDATE
I tried this code, but the result doesn't valid (not play in browser for example):
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); // error here ?!?
recorder.setAudioSamplingRate(96000); // what value ?
These codes work to produce an m4a file:
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC);
or
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
with
mRecorder.setAudioChannels(1);
mRecorder.setAudioSamplingRate(44100);
mRecorder.setAudioEncodingBitRate(96000);
mRecorder.setOutputFile(absFilePath);// must have an .m4a extension
Try the bellow link
how can i record audio file as .m4a format?
OR
http://www.benmccann.com/blog/android-audio-recording-tutorial/
this may help you.
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