Sound volume on defined frequency (C#)

2019-03-05 04:37发布

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.

标签: c# .net fft Aforge
1条回答
一夜七次
2楼-- · 2019-03-05 04:57

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.

查看更多
登录 后发表回答