Audio Capture In android
To record audio there are so many ways. But Here I write audio recording method using MediaRecorder class.
To use MediaRecorder class ,we must create an instance of MediaRecorder class.
Syntax :
MediaRecorder audioRecorder = new MediaRecorder();
Now we need to set the output , source, encoding format and output file.
Syntax :
audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
audioRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
audioRecorder.setOutputFile(outputFile);
after giving essentially information like source, format and output file, we need to call the method to done the task.
audioRecorder.prepare();
audioRecorder.start();
Whenerver want to stop the recorder we need to call
myAudioRecorder.stop();
myAudioRecorder.release();
0 Comment(s)