I have and android emulator and microphone connected to my pc. I want to capture pcm pulses from microphone (i.e. record voice) and then send to udp socket. please anybody help me in source code at least for voice recording.
Asked
Active
Viewed 1,687 times
2 Answers
2
You can use this code for your audio recording:
MediaRecorder recorder;
void startRecording() throws IOException
{
SimpleDateFormat timeStampFormat = new SimpleDateFormat(
"yyyy-MM-dd-HH.mm.ss");
String fileName = "audio_" + timeStampFormat.format(new Date())
+ ".mp4";
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile("/sdcard/"+fileName);
recorder.prepare();
recorder.start();
}
protected void stopRecording() {
recorder.stop();
recorder.release();
}

Milos Cuculovic
- 19,631
- 51
- 159
- 265
-
AudioRecord Class is more suited for the tasks which envolve RAW data processing..... – Amit Feb 23 '12 at 12:41