I'm using portaudio for I/O audio streaming, and I wanted to apply some equalization on audio input from microphone. I found that most people refer to fft for task like that, so I use FFTW library in my project. My first idea was to select frequency bins in some range, from fft resulting complex array, and increase their amplitudes by scaling them with some factors. But this resulting only in noise, there is no sign of any equalization. So my question is, is it possible to increase volume at specified frequencies, through fft, and if so, how to do that. My experience so far makes me think that any change of those values in fft complex array just destroys the sound. Is there a proper way to manipulate with that complex data from fft resulting array?
Any tips for equalization other than fft are also welcome.

  • 2
    $\begingroup$ Does your code work (not result in noise) if you do the fft/ifft, and don't change any bins in the fft? If not, debug. If so, please show the code for your fft bin modifications. $\endgroup$ – hotpaw2 Feb 17 '14 at 17:05
  • 1
    $\begingroup$ "apply some equalization on audio input from microphone. I found that most people refer to fft for task like that" It's easier to just do time-domain filters. $\endgroup$ – endolith Jul 31 '14 at 21:09

You applied the FFT to the full signal? Then modification of the amplitudes will likely destroy any time locality.

Use the so-called STFT, short term Fourier transform, or overlap-add method to get a time-localized frequency analysis.

  • $\begingroup$ What do you mean by 'full signal?' I capture and process input in small blocks $\endgroup$ – user155 Feb 17 '14 at 19:56
  • 1
    $\begingroup$ This was not entirely clear from your question. So the first condition is met. Do you also use windowing in such a form that overlapping segments add to one, i.e., that the shifted window functions form a partition on one? $\endgroup$ – LutzL Feb 17 '14 at 21:45

If you want a real result, then the full array given the IFFT has to be complex conjugate symmetric. But you are modifying only half of the array (below index 513) and not the other, rendering a symmetric array non-symmetric.

In addition, a brick wall transition may produce ringing artifacts. In addition, if you are processing blocks of a longer signal, then overlap-add or overlap-save using longer FFTs is required to avoid circular convolution artifacts.

  • $\begingroup$ In the Documentation you can see that all the arrays are sized correctly. And I 've got the real result. $\endgroup$ – user155 Feb 18 '14 at 10:49
  • $\begingroup$ The real result isn't the complete result if your input (all 1024 bins) to the ifft isn't conjugate symmetric. Test this. $\endgroup$ – hotpaw2 Feb 18 '14 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.