如何从麦克风输入获取音量
我通过 AudioRecord 接口使用麦克风输入 (3.5mm) 作为一种模数转换器。我需要大约每 1(最坏情况)到 3(最好情况)毫秒采样一次并测量体积(相对电压)。只要我能看到峰值,绝对电压并不重要。
问题是我对音频知之甚少。有人可以建议我如何设置我的 AudioRecord 和缓冲区,例如大小等吗?
不使用FFT算法是否可以观察幅度?
谢谢
I'm using the mic input (3.5mm) as a sort of analog to digital converter through the AudioRecord interface. I need to take a sample approximately every 1(worst case) to 3 (best case) milliseconds and measure the volume (relative voltage). Absolute voltage isn't really important as long as I can see the peak.
The problem is I know very little about audio. Can someone recommended how I setup my AudioRecord and buffers, like what size, etc?
Is it possible to observe the amplitude without using a FFT algorithm?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该应用程序是实时的还是您要记录波形、存储它然后查看它?对于这个答案,我假设处理将离线完成。
您需要每 1 - 3 毫秒采样一次(从最坏到最好的情况)。如果我的计算没有错误,那就意味着采样率分别为 1000 - 333 Hz。 Android 中的采样率受到编码器(输出格式)的最低采样率要求的限制。查看支持的音频/视频格式,它似乎不是大多数格式将支持您选择的采样率。因此,您可以尝试以 wav 格式进行编码(它可能具有您需要的采样率),或者以任何格式记录波形,下采样到您所需的频率范围,然后进行分析。
此外,您还可以查看此应用程序 - Audalyzer 用于查看波形。
是的,您可以在不进行 FFT 的情况下查看幅度,事实上,不对信号进行 FFT 处理并按照记录时的方式(在时域中)查看它,可能是最好的方法。
HTH,
斯里拉姆
Is this application real-time or are you going to record the waveform, store it and then look at it? For this answer, I have assumed that the processing will be done offline.
You need to take a sample every 1 - 3 milliseconds (worst to best case). If my calculations are not wrong, that would mean a sampling rate of 1000 - 333 Hz respectively. The sampling rate within android is constrained by the minimum sampling rate requirements of your encoder (output format). Looking at the supported audio/video formats, it does not seem like most of the formats would support a sampling rate of your choice. So, either you could try encoding in the wav format (it might have the sampling rate you need), or record the waveform in whatever format, downsample to your desired frequency range and then analyze.
Also, you can look at this application - Audalyzer for viewing waveforms.
And yes, you can look at the amplitude without getting an FFT, in fact, not FFT-ing the signal and viewing it just as it was recorded (in the time domain), is perhaps the best way to go.
HTH,
Sriram