C++ ShortFastFourierTransform::class OWL API

Dear all,
i’m creating a Template to work with Short Time Fourier Transform ( windowed FFT ).
Do to lag of informations and example on that subject i create this discuttion to try to make it work together. in fact the idea is the perform a windowed FFT on incoming signal.

The inputs of the function is ShortArray and the output is ComplexShortArray
Could ShortArray for example refer to my left channel ? from the

FloatArray left = buffer.getSamples(LEFT_CHANNEL);

or how shoud i do to pass data to the ShortFastFourierTransform::fft function ?

The output ComplexShortArray i will guess is the real an imaginary values or let’s say the spectral frame.
so we know that the spectrum of a real input signal is symmetrical and therefore half of it is redundant
so we will have an output of the spectral frame that is redundent and we could devide it on half the FFT size, to process further more the spectrum.

If we have this working it will open up for me a great area where i could make spectral processing on the owl platform and this will be just great to create some spectral filters and spectral delays.
and i will come to this soon to share with you all of that if this first step is clear for me.

All the help will be appreciated.
all the Best
Omar

Hello Omar,

Good to see more people using C++ on OWL recently! I would suggest looking at the example patch by @mars here: https://github.com/marsus/MyPatches/blob/master/FFTThroughPatch.hpp

It uses OWL’s FFT classes to perform resynthesis with FFT and applies windowing function, so this could be very similar to the template that you’re looking for. Generally you should be using float arrays instead of short arrays, because that would end up with less artifacts from audio processing. But you could try replacing floats and related classes with short integers to see if that makes noticeable difference to audio quality or CPU usage.

There’s another patch in there that does a bit more processing - it shifts magnitudes in frequency domain.

I’m not 100% sure that current version of those patches would compile out of the box (there have been lots of changes to C++ OWL library in last year), but it should take little effort to get them working in such case.

Good luck,
Stas

Exciting!

Here’s the FFT Through patch in the patch library.

It compiles fine, but it has another shortcoming, or rather, the current firmwares do.
In this patch, the FFT size is fixed to twice the blocksize, and the input and output are windowed. This works well with large blocksizes, e.g. 512 or 1024 samples.

The problem is that since introducing OpenWare, the blocksize is no longer configurable. In fact in most cases it is fixed to 64 samples, and an FFT transform with 128 bins doesn’t sound very convincing.
It’s been on the todo-list for ages, so I guess this is a good reminder to fix it :slight_smile: