定义频率下的音量(C#) [英] Sound volume on defined frequency (C#)

查看:66
本文介绍了定义频率下的音量(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白为什么音量定义频率不符合预期.

I do not understand why the volume defined frequency is not as expected.

我依次以指定的几个频率将声音发送到我的麦克风.然后,我对麦克风缓冲区进行FFT.在FFT退出时,我有一个复数数组.要了解所定义频率上的声音音量,请看一下我的阵列,通过这种方式我可以看到该阵列中的元素数量:

I send sounds to my microphone with a few specified frequencies in turn. I then do FFT of my microphone buffer. On exit of FFT, I have an array of complex numbers. To know the volume of sound on the defined frequency, I look at my array, the number of element in this array I get this way:

MyFrequency = n*SamplingRate/SizeOfArray.

接下来,我得到复数的大小

Next, I get the magnitude of complex number

(sqrt(Re^2+Im^2)

如果我是对的,这会告诉我该频率下的音量.但是,该值会根据频率变化很大.如果我错了,请向我解释为纠正错误需要做的事情.如果我是对的,请向我解释为什么这个值变化如此之大.

If I'm right, this shows me the volume of sound on this frequency. But this value changes strongly, depending on the frequency. If I'm wrong, please explain to me what I need to do in order to correct my mistake. If I'm right, please explain me why this values change so much.

推荐答案

您是否要应用窗口功能在FFT之前?如果不是,那么您将看到光谱泄漏的影响,并且任何给定FFT仓的幅度将仅当原始频率恰好是采样率的整数倍时,才是正确的.

Are you applying a window function prior to the FFT ? If not then you will see the effects of spectral leakage, and the magnitude at any given FFT bin will only be correct if the original frequency is an exact sub-multiple of the sample rate.

这篇关于定义频率下的音量(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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