How to make an FFT block in c++

Hello,

I’m trying to make an FFT block in my hierarchical block, but I cannot
seem to find the correct syntax.
I’m trying to make it with a BLACKMAN_HARRIS windowing function, and
it’s easy in a python program:

                    fft_forward = fft.fft_vfc(window_size, True, 

(fft.blackmanharris(window_size)), 1)
fft_backward = fft.fft_vcc(window_size, False,
(fft.blackmanharris(window_size)), False, 1)

But in a c++ program it gets hairy. Does anyone have any experience with
this?

gr::fft::fft_vfc::sptr fft_forward = gr::fft::fft_vfc::make(SIZE, 

true, gr::filter::firdes::WIN_BLACKMAN_HARRIS, num_threads);
gr::fft::fft:vcc::sptr fft_reverse = gr::fft::fft_vcc::make(SIZE,
false, gr::filter::firdes::WIN_BLACKMAN_HARRIS, false, num_threads);

I believe what I have wrong is the Windowing, which is of the form:

const std::vector< float > & window

Sincerely,
Tommy James Tracy II
Ph.D Student
High Performance Low Power Lab
University of Virginia
Phone: 913-775-2241

On Fri, Oct 18, 2013 at 10:05 PM, Tommy T. II [email protected]
wrote:

(fft.blackmanharris(window_size)), False, 1)
I believe what I have wrong is the Windowing, which is of the form:

const std::vector< float > & window

I have only used gr::fft::fft_complex in C++ but I think it uses the
same window type. If that’s true you can create the window using:

window =
gr::filter::firdes::window(gr::filter::firdes::WIN_BLACKMAN_HARRIS,
SIZE, 6.76);

Alex

Thanks a lot. I do have a question about the 6.67 that you pass to the
gr::firdes::window(gr::filter::firdes::WIN_BLACKMAN_HARRIS, SIZE, 6.67);

What is the importance of this value? Is this the default BETA? I found
that when creating a BLACKMANHARRIS window in python and c++, I got two
different results.

Sincerely,
Tommy James Tracy II
Ph.D Student
High Performance Low Power Lab
University of Virginia
Phone: 913-775-2241

On Fri, Nov 1, 2013 at 6:16 AM, Tommy T. II [email protected]
wrote:

Thanks a lot. I do have a question about the 6.67 that you pass to the
gr::firdes::window(gr::filter::firdes::WIN_BLACKMAN_HARRIS, SIZE, 6.67);

What is the importance of this value? Is this the default BETA? I found that
when creating a BLACKMANHARRIS window in python and c++, I got two different
results.

If I recall correctly that parameter is only used for the Kaiser
window and not for the others.

Alex


Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

On Fri, Nov 1, 2013 at 4:42 PM, Tommy T. II [email protected]
wrote:

Youre right; the following syntax is the least ambiguous for creating
Blackmanharris windows in c++:

const std::vector< float > fft_window =
gr::filter::firdes::window(gr::filter::firdes::WIN_BLACKMAN_HARRIS, 1024,
NULL);

I’m actually going to update that to have a default argument for beta,
so you don’t even need to set anything if you aren’t using a Kaiser
window.

Tom