FFT using vectors

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

There ae some people here that said in the past that it was possible, but they are mathematically wrong. No matter how hard they try, mathematics say they are wrong. You can't filter directly in spectral domain a non stationary signal.

Post

Time-domain filter design is messy. I'm always hesitant to use Remez exchange and Parks-Mcclellan for long filters for fear of no-convergence.

Post

Well, it's the only thing you can do. Designing them directly in spectral domain just doesn't work. Try to change the size of the FFT, and see how you get different results and signal appearing before it should and not continuing when it should. Feed a dirac to such a shitty model, and you will see: it can't work.

Post

Suppose you have designed an M point kernel using Remez. FFT of that is something you can use to implement a fast convolution using multiplication, yielding an M+N-1 length signal.
Assuming a FFT length K > M + N -1

- in the time domain zero pad the N-samples signal to have K samples, call that X
- in the time domain zero pad the M-samples kernel to have K samples, call that Y
- multiply FFT(X)*FFT(Y) to give, lets say Z.
- IFFT(Z) should be a M+N-1 length signal in a K-samples window, the rest being zero.

With a processing window of length N, this yields a convolution with a tail signal of length M-1 to be appended to each successive window.

Now the question is, does Remez really have anything to do with what's going on here? M-1 samples long tail for each window cannot be ignored, that appears to be the main problem. That Remez is a good filter design method and replacing it with a poorer one is a bad idea seems to be a separate issue.

People propose such algorithms with the hope of changing the kernel on the fly - but that's entirely a different matter. In that case a different sort of overlapping window processing is necessary to handle discontinuities using some kind of linear interpolation between overlapping windows. Not that it looks elegant but to me it seems like algorithms like this are part of many practical solutions, audio compression is one, noise reduction is another.
~stratum~

Post

I have found a longer explanation of what Remez algorithm would be doing right https://www.dsprelated.com/freebooks/sa ... omain.html

As stated basically the problem is undersampling (or "not enough bandwidth", if you would excuse the term abuse) in during filter design in frequency domain - the minimum required number of samples to avoid aliasing (ambiguity in valid interpretations of the result) due to circularity of the mathematical mapping involved is K=N+M-1 while we need an M samples kernel to work with. So the K-length kernel needs to be reduced to an M-length kernel, and that will necessarily involve some information loss. The method in ch 17 of dsp guide solves that by using a larger FFT window and truncating the resulting impulse after centering it inside the window and multiplying with a window function (Hamming or Blackman is specified), leaving M samples for the kernel as intended after a symmetrical truncation. The problem is that while the aliasing problem is solved, FFT of the truncated impulse does not exactly match the specified desired one and deviates a lot at low frequencies, and is probably a suboptimal solution for the kernel length used. The missing step compared to the Remez algorithm is the idea of improving iteratively instead of just manually checking the correctness of some suboptimal solution, which could improve the low end at the cost of reduced precision elsewhere.

Given that the shape of the Hamming window is thishttps://www.mathworks.com/help/signal/r ... hworks.com and the Blackman window is this https://www.mathworks.com/help/signal/ref/blackman.html

Multiplying the kernel with these shapes at the time domain would result with convolution with the FFT of the same shape in the frequency domain with the FFT of the kernel (the desired response), and that looks like a low pass filter on the shape of the desired frequency spectrum curve. That is why the bass response suffers, it cannot rise from zero to the desired value immediately.

Kind of like how frequency domain aliasing problems are solved but this one doesn't include a downsampling step, and the "low pass filter" in use seems to be arbitrary.

Enough rambling I guess, for something that is probably already clear from a mathematical perspective :scared:
~stratum~

Post

Feels a bit more complicated than I thought. I'm not feeling well enough at the moment to try to understand what to do.
I managed to bandlimit the waveform the wrong way, all though the resulting waveform only had half the amplitude of the original. I would of course do it the other correct way if I could only understand how.
Last edited by Xenobioz on Mon Jun 26, 2017 5:37 pm, edited 1 time in total.

Post

It's not that complicated but can take time to understand if you are learning this by yourself. You'd say look for a few video tutorials in youtube for a visual clue but apparently there isn't one that is any good, most of the time you'd be saying "OK we got that already" and be skipping fast forward.
~stratum~

Post

Use a library that already implements it ;)

Post

Use a library that already implements it ;)
That's the default choice from an implementation perspective ;)
~stratum~

Post

Do you have any suggestions for such libraries? :)

Post

You can try Audio ToolKit. I don't have many people using the Remez part, but it works according to the litterature (http://blog.audio-tk.com/2017/04/11/aud ... eq-module/)

Post

Thanks! Do I need the whole library or do I just include the files for remez, and what file should that be. (remez based filter?). :oops:

Post

You can extract what you want, as RemezBasedCoefficients will basically just create a array of coefficients. But you can/should use the full library if you plan on having EQs, delays, distortion, simple math operations...

Post Reply

Return to “DSP and Plugin Development”