如何比较两个捕获以查看哪个更响亮? [英] How can I compare two captures to see which one is louder?

查看:24
本文介绍了如何比较两个捕获以查看哪个更响亮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定从麦克风捕获的两个字节的数据数组,我如何确定哪一个具有更多的噪声尖峰?我假设有一种算法可以应用于数据,但我不知道从哪里开始.

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.

说到底,我需要能够确定婴儿何时哭泣与房间内的环境噪音.

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

dB = 20 * log-base-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.

我建议您查看噪声门的源代码,它几乎可以满足您的需求,并且具有可配置的攻击时间和阈值.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆