DSPRelated.com
Forums

Window Impulse Response

Started by Samp17 5 years ago12 replieslatest reply 5 years ago992 views

I have used a generated Log Sine Sweep as stimulus for a loudspeaker under test. 

 I record the input to a measurement microphone with long enough sample size for the reverb to decay.  

I then perform an FFT on the input and the known stimulus signal, and then multiply the results with the FFT of the inverse sweep signal to compensate for the decreasing power in frequency of the stimulus.  

I then divide the input FFT by the stimulus FFT, and perform a reverse FFT on the result to get back to the time domain.  This gives me a clean impulse response. (The system being the loudspeaker and the room).  

In a noisy room, I do not have a clean impulse response and would like. to perform windowing on this to try and remove some of the room (especially if there is a visible reflection).  To do this, I have created a Hamming window of variable length, with zeros to extend to the same length as the number of points in the FFT signal, and multiplied the Impulse response. by the window. This seems to have created a low pass filter if I perform an FFT of my windowed impulse response.  The smaller the window size (narrower), the higher the frequency of the low pass filter.  


Am I approaching this the correct way, and is there any suitable window that will allow. full spectrum (up to Nyquist frequency) without attenuation inside the pass band.  I am guessing a flat top or rectangle?  

The secondary question,  if I move my window to outside of the impulse (to an area of no noise),  My windowed impulse is an array of zeros.  If I perform an FFT on this windowed impulse, I am still presented with magnitude data,  whilst attenuated down, the data is still present.  Should I expect to see this?  Thanks

[ - ]
Reply by lamabrewJune 27, 2019

There's a couple of things in what you state that don't sound quite right to me, but I've also been away long enough from the details that I'm probably wrong about that...

Instead I'll suggest fire up REW (Room EQ Wizard) and compare your results to that as well as review the considerable technical details that are provided with it. I suspect that will point to where your issue(s) are.

[ - ]
Reply by neiroberJune 27, 2019

Hi Samp17,

When using a window, be sure to multiply your signal by the window, sample-by-sample.  That will allow your spectrum to cover the range of 0 to fs/2.  You should **not** convolve the window with your signal.

See my post https://www.dsprelated.com/showarticle/1211.php, which discusses windows.  The post also contains some references you may want to look at.

regards,

Neil


[ - ]
Reply by Samp17June 27, 2019

Hi Neil,


Thanks for this. I shall have a thorough read through. 

It is my understanding that the impulse response represents a system, not a signal (maybe this is where I am getting confused).

For clarification I have not performed a dot product between the window and impulse, I have instead multiplied each element (ie a1 x b1 = c1, a2 x b2 = c2). With c being the product vector. If I draw this vector it visually looks like the impulse has been attenuated correctly by the window, but clearly there’s more going on  


[ - ]
Reply by neiroberJune 27, 2019

The impulse response just the output of your system when the input is the unit impulse function.  The Fourier transform of the impulse response is the transfer function of the system.

Note windowing is normally performed on a time domain signal.


[ - ]
Reply by dszaboJune 27, 2019

Windowing is the correct thing to do.  Although I don’t totally follow your process exactly, I think a few points would be helpful.

First, the impulse response of a loud speaker is causal, non-linear phase. What this means is that if you look at the impulse response, it will be localized at the beginning and taper off.  If you simply apply some go-to window, it will severely attenuate the part of the waveform you care about.  Make sure you center the window about zero.  In another sense, use half the window, you’re just trying to taper the end of it.

Second, a multiply in one domain is a convolution in the other.  So when you window/multiply in the time domain, you are filtering/convolving in the frequency domain.  This can be a bit strange on terminology, but there are some key factors to why this is useful.  Noise in the time domain is equivalent to noise in the frequency domain.  Windowing “smooths” our the noise in the frequency domain.  The smaller the window, the more the smoothing is applied.  This is mathematically equivalent to filtering, but I don’t think that’s the correct term for the frequency domain

Hope that helps.  Best of luck and please feel free to share you’re results.  It sounds like a fun project!

-Dan

[ - ]
Reply by dudelsoundJune 27, 2019
I think I would use the terms "smearing" or "smoothing" instead of "filtering" in the frequency domain - if you multiply the time domain signal with a window function, you smear the frequency domain signal with the transformed window function. You average several spectral bins, so it is smoothing and at the same time you loose frequency resolution, of course.

Smearing and smoothing are simply non-technical descriptions of what happens when you convolve a signal with a low-pass kernel - and all popular window functions are low-passes when used as filter kernels

[ - ]
Reply by dszaboJune 27, 2019

I believe we are in need of a word for filtering the frequency domain. I would like to suggest “liftering”.  Because it’s more fun to say than windowing. 

[ - ]
Reply by kazJune 27, 2019

I will go for "Flirting"

[ - ]
Reply by MJLJune 27, 2019

If you want the impulse response of the loudspeaker AND the room, then I suggest using e.g. a half-Hanning window.  This will preserve the initial section of the IR.

If you want only to preserve the loudspeaker's IR, then extract the IR up to a zero-crossing point before the first reflection.  This can then be copied into a zeroized array of the length you require for any further FFT processing.  Note that it MUST be a zero-crossing point, else any FRs will be compromised.

[ - ]
Reply by jbrowerJune 27, 2019

Samp17-

Normally windowing is needed for sliding FFT analysis, when there is "edge noise" due to sectioning data into frames on an arbitrary basis (i.e. some "frame size" based on inherent properties of the data, such as speech), and frames are overlapped for each successive FFT.  In your case, for audio impulse response analysis, you are FFT'ing the "whole enchilada" (I assume with a very large FFT size, 64k or higher).  If your sine sweep amplitude more or less starts and ends at zero (does it ?) then you don't have an edge noise issue and don't want a window -- otherwise you will attenuate both ends of your impulse response; i.e. both low and high frequencies of the sweep.

Controlling the amount of distance of reflections in your analysis is more of an echo / reverb problem.  For this you might look at TDS and MLS measurement methods.  Both are intended to allow you to control the duration of time over which you calculate, in an effort to control which reflections you include in your analysis.

-Jeff 

[ - ]
Reply by Samp17June 27, 2019

Thank you for all the comments. I am trying to achieve something similar to Room EQ Wizard, systune, wavecapture. 

Now I know they window the impulse in a similar way, but I’m essentially trying to reverse engineer what they do (and I am only a hobbyist). 

in terms of reading material, everything I can find regarding windowing is referring to windowing frames of a continuous signal to taper to zero at the ends. My signal is a generated log sine sweep starting at 20Hz and going to 20kHz. I must admit I have not looked at zero crossing points for my window. I am allowing the user to alter the width of the window and the window centre, so they can position it on the peak of the impulse and include energy before and after. 

This is just one long FFT of Size 32768 samples. So a discrete signal.


Just to give you all info on what I am trying to achieve and what the project is. I shall have a thorough read through the responses already on here and see if I am successful with any of the suggestions. 







[ - ]
Reply by dszaboJune 27, 2019

A simple solution might be to allow the user to trim the impulse response and apply a fade in/out. It would be more or less equivalent to what you would do with the window.  It would also be good for audio engineers because it would work like existing DAWs.