2

I want my app to react on a load sound like a clap. The problem is, that getMaxAmplitude() reaches it's maximum of 32762 even when talking in a normal voice which is >= my "allMaxAmpli" variable set in the config mode.

The media recorder is set up like this:

mrec = new MediaRecorder();
mrec.setAudioSource(MediaRecorder.AudioSource.MIC);
mrec.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mrec.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
[..]
mrec.setOutputFile(audiofile.getAbsolutePath());
mrec.prepare();
mrec.start();

and the check is done like this (abstracted):

int maxAmp = mrec.getMaxAmplitude();
if (maxAmp >= CalibAmp)
  Log.v("ID", "Max Amp is greater!");

Did i miss something?

Is there some other way to measure the volume, or increasing the limit for getMaxAmplitude? I thought about using AudioRecord, but then i'd have to calculate the amplitude by hand. I wanted to save myself from that.

I searched for quite a bit before considering posting, but i was unable to find anything. Any help would be appreciated.

/Edit: If i calculate the decibel out of the amplitude, will this get other values? This might solve the problem then.

/Edit2: I calculated the decibel out of the amplitude, but the problem persists, since the Amplitude is so high all the time. Nobody has an idea? :/

/Edit3: After testing some other Apps it seems that this is a general problem with Android. So that is why every sound measuring app is free..

Gerd
  • 79
  • 1
  • 9

0 Answers0