Sound volume on defined frequency (C#)

只愿长相守 提交于 2019-12-04 06:41:49

问题


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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/13247904/sound-volume-on-defined-frequency-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!