I would like to estimate the impulse response of a simple environment (room, two speakers, one microphone). I am aware of the issues/limitations of working with "near" LTI systems. That said, I have a rather basic question regarding the mechanics of performing cross-correlation using audio which has been recorded in my environment.

A: my original audio (swept sine) - 1 second in length, 16 bit, 44.1K

B: the result of recording A in my environment

enter image description here

Again, my goal is to calculate the environment's impulse response, h[n], by calculating the cross-correlation of A and B.

Here is my question: I don't know if I should be doing anything to B (trimming on either end, shifting towards the left, etc.) before attempting to estimate the impulse response. The goal will be to use the IR to model what arbitrary audio will "look" like when played in my environment.

Additionally, I'm not sure how long (in # of samples) my IR should be. I've read that using a shorter IR can speed up processing without too much loss in estimating y[n] (the output of the system).

In the final version of this experiment the recording of B will be automated thus I'll need to know how long the recording needs to last to fully capture A's signal.

Thank you in advance.


1 Answer 1


The easiest way to calculate the impulse response is to divide the spectrum of the measured signal by the spectrum of the excitation and do an inverse FFT of the quotient. That's mathematically equivalent to the cross-correlation method but typically easier. It requires that the excitation signal has a reasonable amount of energy at all frequencies so you don't get any "divide by 0" problems.

The length of the impulse response is mostly determined by the reverberation time of the room. For most of home environments that's well below 0.5 seconds so 1s excitation should be plenty. For convenience I would chose a power of two, which makes the FFTs easier. You can still truncate after the IR has been calculated.

Most acoustic systems are actually strict LTI (if no one moves about), however the signal to noise ratio (SNR) tends to be poor especially at low frequencies. A good way to deal with this is to do "coherent averaging". Create a periodic excitation (just keep repeating the sweep), throw away the first two frame acquisitions (long story) and then keep averaging the acquired frames. 10 averages will give you an SNR gain of 10 dB.

Getting the excitation level right is critical: if it's too low the SNR is bad and if it's too high, something will be overdriven and become non-linear. The speakers are probably the first candidate for distortion.

  • $\begingroup$ isn't that deconvolution rather than cross-correlation? $\endgroup$
    – endolith
    May 23, 2013 at 21:26
  • 1
    $\begingroup$ It's mathematically the same. Either you calculate the spectrum of the IR as Y/X or YX'/(XX'). The second is simply a simplified version of the first. $\endgroup$
    – Hilmar
    May 24, 2013 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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