Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在某些级别的声音接收和停止录音机没有收到声音时重新编码声音。
我最初使用媒体录音机检查最大振幅,然后我开始通过录音机录制,但我无法停止它,因为录音机没有任何方法来获得最大振幅。
你应该尝试这样的事情:
readAudio = audioRecorder.read(data16bit, 0, buffer); double fN = (double)readAudio; double accum = 0; for (int i = 0; i < readAudio; i ++) { accum += Math.abs((double)data16bit[i]); } double soundLevel = accum/fN;
然后检查 soundLevel 的值以查看应用程序应该何时停止录制。