0

My app records audio in amr format. It works pretty well on some devices but on others it fails to record audio during a phone call. From the recorded file you can clearly tell that the recording is ok and you hear everything until the moment the phone starts ringing and from there the audio is muted.

This is observed on a Samsung GT-I9000 running ICS 4.0.4 while on my htc it works well.

Here is how I setup the recorder:

mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
final String path = getRecordingAbsPath();
mRecorder.setOutputFile(path);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.prepare();
mRecorder.start();
gop
  • 2,150
  • 5
  • 26
  • 54
  • Possible dup of http://stackoverflow.com/questions/11776366/audio-recorded-from-microphone-is-muted-during-the-voice-call/ – Michael Aug 09 '12 at 09:05
  • yes it seems to be a similar problem but I see they just assume its platfomr dependent. I want to know how am I supposed to record audio on samsung devices without having this problem. I am willing to change the format from amr to something else. – gop Aug 09 '12 at 09:38
  • 1
    As I wrote in my answer for the other question, it might simply not be possible on some devices. I've worked on the audio HAL on a bunch of Android phones, so it's not merely an empty assumption. The format that has the best chance of succeeding (besides AMR_NB which you've already tried) is probably 8 kHz mono 16-bit PCM. – Michael Aug 09 '12 at 09:42
  • Thanks @Michael so pcm this corresponds to the constant mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); right? Should I also change this line mRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);? Hopefully this would work. – gop Aug 09 '12 at 10:41

1 Answers1

0

This seems to be a hardware limitation as Michael noted.

gop
  • 2,150
  • 5
  • 26
  • 54