我如何可以比较两个捕获,看看哪一个更响亮? [英] How can I compare two captures to see which one is louder?
问题描述
由于从麦克风捕获的数据的两个字节数组,我怎么能确定哪一个有更多的噪音尖峰?我会假设有一个算法,我可以适用于数据,但我不知道从哪里开始。
Given two byte arrays of data captured from a microphone, how can I determine which one has more spikes in noise? I would assume there is an algorithm I can apply to the data, but I have no idea where to start.
获取到它,我需要能够确定何时宝宝哭闹VS在室内环境噪音。
Getting down to it, I need to be able to determine when a baby is crying vs ambient noise in the room.
如果有帮助,我现在用的是Microsoft.Xna.Framework.Audio.Microphone类来捕捉声音。
If it helps, I am using the Microsoft.Xna.Framework.Audio.Microphone class to capture the sound.
推荐答案
您可以将每个样本应用下面的公式转换(标准化为1.0〜-1.0)成分贝的评价
you can convert each sample (normalised to a range 1.0 to -1.0) into a decibel rating by applying the formula
分贝= 20 *日志基10(采样值)
dB = 20 * log-base-10 (sample-value)
要诚实,只要你不介意偶尔的假阳性,并且您的麦克风设置好了,你应该没有问题,告诉一个婴儿的啼哭和环境背景噪声之间的差异,而不需要通过麻烦中做一个FFT。
To be honest, so long as you don't mind the occasional false positive, and your microphone is set up OK, you should have no problem telling the difference between a baby crying and ambient background noise, without going through the hassle of doing an FFT.
我建议你在看看源$ C $ C为噪声门,这的确pretty的太多你是什么后,可配置的发作次数和放大器;阈值。
I'd recommend you having a look at the source code for a noise gate, which does pretty much what you are after, with configurable attack times & thresholds.
这篇关于我如何可以比较两个捕获,看看哪一个更响亮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!