Is that possible to get the current sample amplitude by MediaRecorder or other class

我只是一个虾纸丫 提交于 2019-12-24 04:34:07

问题


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:


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.



来源:https://stackoverflow.com/questions/2010800/is-that-possible-to-get-the-current-sample-amplitude-by-mediarecorder-or-other-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!