discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Floating point FFT usage - suppress half of it?


From: Maximilian Stiefel
Subject: Re: [Discuss-gnuradio] Floating point FFT usage - suppress half of it?
Date: Mon, 19 Mar 2018 01:35:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi Brad,

> Taking a step back, maybe the mirroring is a product of the method I'm
> using to interpret the output of the FFT.

I really do not think so, because, as explained below and in the previous mail, the phenomenon, we witness here, results from the physics behind signal theory.

As I understand your code, you are calculating the Energy Spectrum Density (ESD), because you take the square of the magnitude of the FFT. The ESD gives you the energy distribution of the signal over the spectrum.

https://en.wikipedia.org/wiki/Spectral_density#Definition

It is legitimate to design audio signal analysis like that, from my point of view. To interpret your results one can say, that the ESD (let's call it Psi(w)) has the following properties:

Psi(w) = Psi(-w) (even)
Psi(w) >= 0

This properties also accord to what I explained in my previous mail. A "natural real signal" such as the output from your wave file consists out of an odd and even part i.e.

s(t) = se(t) + so(t).

We said, that the even part corresponds to an even real part in the frequency domain and the odd part corresponds to an odd imaginary part in the frequency domain. However, by taking the square of the FFT's magnitude (this is what I saw in your code) you will make the whole spectrum even and real e.g.

( j*sin(x) )^2          =       -sin^2(x)
     ^                             ^
odd and imaginary             even and real

Thus, your output corresponds to the underlying physics.

> If we listen to a dial tone recording for example, we can clearly tell
> that two and only two tones are present. Is FFT able to tell us the same
> thing (exactly two spikes, at expected frequencies) if given floating
> point samples rather than complex?  (Tried this using wx gui FFT plot
> and I don't see mirroring, does the WX GUI FFT suppress the mirroring?)

Yes, the DFT/FFT/"Fourier transform of the signal" is exactly what you need. Bin [-512 to -1] are the negative frequencies (which you do not seem to be interested in) and bin [0 to 511] are the positive frequencies you want evaluate.

The sharpness of the frequency peaks you are expecting has something to do with the window you are using. I saw you used a Blackman-Harris window. Try playing around a bit with this setscrew if you are not happy with your results.

Two further comments:

1) If your application is about loudness as perceived by humans you have to introduce a model for the ear as we do not hear linearly.

2) It is impressive how you visualize your ESD on console, but why are you not using the mighty QT GUI Time Sink or a python plotting library like matplotlib to plot your result? (Played around with it recently https://gist.github.com/m3x1m0m/1d524d560ff2f3e0702ca6c5d73bcff1)

Regards,

Max



reply via email to

[Prev in Thread] Current Thread [Next in Thread]