本文介绍了声级计机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想实现一个声音米分贝的Android,但我还没有找到尚未启动的方式。我已经在机器人API,并没有发现任何东西,我认为是合适的。任何人都可以帮助我吗?
I'm trying to implement a sound meter in dB in android but I haven't found the way to start yet. I have gone over androids API and haven't found anything that I think is suitable. Can anyone help me please?
推荐答案
请尝试使用 AudioRecord 以记录音频到一个缓冲区,然后从原始PCM数据测量分贝的
Try using AudioRecord to record the audio to a buffer, then measure the dB's from the raw PCM data.
要初始化 AudioRecord
AudioRecord record = new AudioRecord(AudioSource.MIC, SAMPLING_RATE, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize);
要由MIC读取样品
short[] buff = new short[8000];
record.read(buff, 0, buff.length);
这篇关于声级计机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!