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: Brad Hein
Subject: Re: [Discuss-gnuradio] Floating point FFT usage - suppress half of it?
Date: Mon, 19 Mar 2018 22:29:59 -0400


A few final clarifying questions, inline below:


On Sun, Mar 18, 2018 at 8:35 PM, Maximilian Stiefel <address@hidden> wrote:
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.

Thank you for the suggestion!
 

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.

This is a good point that I will keep in mind, although my application of this work is not intended for comparison with perceived amplitude, it may be useful to process it that way so I will look into it.
 

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)


Thank you for the kind suggestion - I haven't explored the QT UI much but I tried the time sink and found it useful. I went with ascii art initially so that I could gain an intimate familiarity with the vector sink and its behavior.


I have to confess I am struggling with the math descriptions provided. If I may, I would like to ask a few questions simplified into terms that I I think I can understand the responses to:

- Is it true then that if I have a 100-bin FFT, that each of the "left 50" equals the negative of its corresponding right-side bin?

- Is there any use for "negative frequencies" if my goal is to simply measure the ESD for each of the frequency bins?

- If I want to get 48 usable frequency bands, each corresponding to a 0-1k, 1k-2k, 2k-3k, etc do I actually need a 96 bin FFT due to the mirroring?

- Do the negative frequencies correspond to a phase difference compared to the positive frequencies - in other words if I have two 2600Hz signals that are out of phase by 180 degrees, would this be reflected in the negative vs positive bin associated with 2600Hz?

Thanks!
Brad

 
Regards,

Max

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

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