views:

217

answers:

2

Hi everyone, I have a media recorder, and want to record a media from mic and get it's amplitude sample. I want to try to get the correct and current amplitude instantaneously when calling some API. But there is just one API in MediaRecorde for getting amplitude: getMaxAmplitude, and it is used to get the maximum absolute amplitude measured since the last call. Is that possible to get the current sample amplitude instantaneously by MediaRecorder or other class from mic?

Thanks, Best regards, Chen

+1  A: 

The documentation for MediaRecorder.getMaxAmplitude says:

Returns the maximum absolute amplitude that was sampled since the last call to this method. Call this only after the setAudioSource().

Thus, you could just sample twice over a small time interval and look at the second value. That would effectively be an instantaneous sample.

John Feminella
A: 

thanks for your response. I will try this method first.

White Chen