This question is more or less the following of a previous question.

The aim is to equalize some sounds signals. By equalizing, I mean increasing or decreasing some frequency ranges, a bit like an analogic equalizer. The process I am applying now is :

1/ getting the temporal sound signal

2/ getting the "spectral correction" coefficients for each frequency sample

3/ converting the spectral correction to a "temporal correction" by using a FFT

4/ convoluting the temporal sound signal with the "temporal correction".

I have many questions with that process.

The first one is : what about the phasis ? The temporal sound frames are integers given by by wav file. So, if I write them with a complex number, the real part will be the value of the sample and the imaginary part will be 0.

But when i convert the spectral correction to a "temporal correction", some imaginary values may appears. And, after my convolution, I'll get a temporal signal with some imaginary parts wich will be different from 0. So, how, coming back to a temporal signal with a phasis = 0 ? Shall I use the modulus of the complex get by my convoluted signal ?

I also have a question about the "temporal correction". For testing, I'm using a "blank correction" : all the spectral coefficients = 1 so, my signal convoluted should be equal to the original signal. When I calculate the FFT of the spectral correction, I get a tab with those values {1, 0, 0, 0 (...)}.

So, my second question is : Does this result is logical or shall I get {1, 0, 0 (...), 1} because of the hermitian symmetry ?

And my third (and last) question is : What about the "padding" ? I'm following this website to compute the convolution but, I don't understand how many "0" I do have to add before or after the input signal. Let's say I have a 512 frames sound signal to convolute with a 511 frames "correction signal". Shall I add 511 "zero" before the signal ? or 255 before and 255 after ?

Thank you for all your answers.



First, as long as your filter FFT has hermitian symmetry, the convolution with a real signal should also be real. You may get some residual noise in the imaginary, but you can just pitch it. If you are getting signal in the imaginary, your implementation is goofed.

Second, what you see is correct. Because the time signal is real, the frequency signal has symmetry. The opposite is also true. Sample zero is the point about which the symmetry occurs.

Third, you have two lengths to take into account. The sample window, N, and the filter kernel, M. The sample window will determine how much real time lag you get through the operation, but is inconsequential in rendered applications. The kernel length determines the number of “taps” in the filter bank. The padding should be such that each signal is M+N-1 long when the operation is performed.

Fourth, this implementation is flawed because you are directly manipulating the signal in the frequency domain. What you would want to do is something like this: every N samples get M samples of the signal. Perform an FFT. Do whatever you need to to calculate the filter frequency response. Set the phase to be linear and centered about the mid point. Calculate the inverse FFT to get the filter kernel in the time domain. Covolve the signals (w/ FFT convolution or directly).

Lastly, as I stated in response to your last question, this is not a good implementation of an analog prototype. Analog filters have poles and should be implemented using biquad filters. See RBJs biquad filter cookbook for a great source on implementing analog prototypes of common audio filters. You can still do it the way I’ve described, but to relate it to the analog domain is a misnomer.

| improve this answer | |
  • $\begingroup$ 2nd point : So, my filter kernel should always be symetrical ? - 3rd point : ok for the padding but where to add it ? Before, after or half / half ? $\endgroup$ – Dr_Click Oct 18 '18 at 17:15
  • $\begingroup$ Your filter kernel should have hermitian symmetry in the frequency domain. Your zero pad goes at the end. $\endgroup$ – Dan Szabo Oct 18 '18 at 18:20
  • $\begingroup$ Thank you for all your answers Dan. I'll read the cookbook. I will still have many questions about digital filtering so, don't hesitate to reply me again in some other posts : you are very helpful. $\endgroup$ – Dr_Click Oct 19 '18 at 6:30

Your Answer

