# Frequency response creates non-causal impulse response

I have frequency response data. It is output from an acoustic simulator.

I convert this into an impulse response, and get:

In that picture the blue line is the impulse response. Mostly it is hiding behind the green line (which is the impulse response if I halve the frequency resolution).

I'm sorry for an unclear picture. I will replace it in due course.

Anyway, the thing I notice of interest is that if the impulse response is regarded as a loop, the ends appear to match up.

Is there any mathematical basis for this?

It seems strange to me that the impulse response is somehow non-causal. Because what it is modelling is a single pressure wave hitting a microphone. Commonsense suggests to me that it should have a very sharp attack as the main wave hits followed by diminishing ripples corresponding to echoes.

So I'm quite surprised to see ripples before the main spike, let alone before t=0, as it were.

Is this some artefact of the FFT due to the fact that it is forced to sample at discrete intervals, therefore the spike cannot be completely accurate, and maybe the preceding wobbles are compensating for this.

In which case would I do better to reposition the start of the impulse response 100 samples in from the end, and have it wrap round?

• What kind of acoustic simulator are you using for that purpose?
– jojeck
Commented Apr 7, 2014 at 18:42

I am familiar with similar phenomena. During measurements with usage of sweep-sine, when you convolve your signal with inverse filter you are obtaining your IR. Although if you consider perfect case of convolving your original sweep $x(t)$ with the inverse filter $f(t)$, then you should get perfect Kronecker delta. Unfortunately what you will get is an impulse with pre and post-ringing: One way to minimise this effect is to use so called Kirkeby Algorithm, described here by A.Farina (my guru of acoustic measurements): Advancements in Impulse Response Measurements by Sine Sweeps. I am sure will find it quite fascinating.

One last tittle-tattle:

Commonsense suggests to me that it should have a very sharp attack as the main wave hits followed by diminishing ripples corresponding to echoes.

You are definitely right, although in real world measurements it is possible to have preceding spike before main impulse in some cases. For example if you place your source close to the wall, then wave from speaker will excite mechanical wave in a wall and wave will propagate in the material with speed of sound much higher than in case of air. Nextly wall will emit acoustic wave that will be captured by your microphone.

Interesting answers so far, but I think it could be something else: Sampling requires to the signal to be band limited. Ideally all energy is very very low as you approach the Nyquist frequency. If your acoustic simulator produces significant energy close to or at Nyquist, you will this type of time domain ringing (which is essentially a form of aliasing). In order to do the FFT you need to have the Nyquist value to be real. If your simulator spits at a value at Nyquist that has a non zero phase, you will also get time domain ringing.

Best would probably be to cascade your frequency response with a low pass filter before doing an inverse FFT.

If you don't have the frequency response's phase data, only the magnitudes, then the impulse response from an IFFT will likely be skewed and/or smeared (circularly) in time from whatever the original waveform was.

• I have the frequency response as a set of complex numbers, so the impulse response is making use of phase data...
– P i
Commented Feb 27, 2014 at 9:52

You need to calculate more frequency points and then use a larger IFFT. Even though the room simulator calculates the response in the frequency domain, there is an underlying room impulse response that has a certain length. If your IFFT is not large enough to accommodate this length then you will get the type of wrap- around that you are seeing. You could also consider this to be a form of aliasing, only going from frequency to time rather than the more usual approach of going from time to frequency. Consider a room with a single long reflection. The frequency response will have periodic wiggles that are spaced by 1/Tdelay. You need to sample these wiggles with at least 2 points per wiggle, which is another way of saying that the IFFT length has to be at least Tdelay long.

Bob

• I don't think that more frequency points will help -- the blue line on the above graph shows what happens when I double the frequency points. It doesn't reduce the ringing at the end.
– P i
Commented Feb 27, 2014 at 12:07

impulseResponses = [impulseResponses(:,end/2+1:end), impulseResponses(:,1:end/2)]

this is the solution, and ya remember to use a higher number of samples for fft bins,