Andy
Andy

Reputation: 259

C++ Frequency response <-> Impulse response

I am trying to calculate an actual frequency response from a desired frequency response.

fftSize = 128;
fs = 8000;

I have 2 input arrays: f[] and aDesired[], both of which are Real and length fftSize+1 (DC + Nyquist included). The f[] array is linearly spaced between 0 and fs/2 (0:4000). The aDesired[] array is either gains in dB or linear values.

I can easily change the length of f[] and aDesired[] as I have an interpolation function which gives any size outputs, but i thought this was a good number.

I would like to take an IFFT of ADesired[] to generate coefficients (with a configurable length), window and truncate the coeffs, and then FFT to show what the actual response would be, aActual[].

How can I take an IFFT/FFT of this data when the inputs are both Real? Or how do I prepare the data more?

Is there maybe a library that could be of use with my input data?

Summary:

Input: f[129] : linearly spaced fc's
       aDesired[129] : Real values of linearly spaced gains at fc's (either in lin or log),

Processing:
       coeffs = IFFT(f, aDesired)
       coeff_new Truncate(window * coeff)
       aActual = FFT(f, coeff_new)

Output: aActual[]

Many thanks

Upvotes: 0

Views: 1357

Answers (1)

Yan Zhu
Yan Zhu

Reputation: 4356

Try IT++, which is for physical layer simulation.

http://itpp.sourceforge.net/4.3.0/

Upvotes: 0

Related Questions