Search code examples
androidaudio-recordingm4a

Record .m4a file Android


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 ?

Solution

  • 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.