Does someone know, how to convert the sweep signal into the impulse response?

What kind of results will come out?

I generated a sweep signal from REW software and then correct the output value sweep signal from the compressor.

How can I convert the sweep signal into an impulse response with MATLAB?

  • 2
    $\begingroup$ Hello Heimishyun and welcome to DSP SE. I think you should provide a little bit more information as to what exactly you are trying to achieve. What is that you are measuring, which measurement method do you use (I assume you use the Exponential Sine Sweep - ESS), what have you achieved so far and where exactly are you stuck. This way will be easier for people to provide help. $\endgroup$
    – ZaellixA
    Commented Mar 12, 2023 at 12:16
  • 2
    $\begingroup$ Your question seems to suggest that you are trying to capture the response of a dynamics compressor. Such a deeply nonlinear system cannot be characterised by its impulse response and a sweep also cannot be used to measure this response. $\endgroup$
    – Jazzmaniac
    Commented Mar 13, 2023 at 0:50
  • 1
    $\begingroup$ Relevant answer: dsp.stackexchange.com/a/41700/8202 However, few notes on your approach. First of all, measuring IR of compressor is not a good idea - it's a Time Variant system due to attack / release. You will get different results depending on length of sweep, it's level, etc. Second of all, RoomEqWizard has a measurement sweep option, where in signal generator you create a recording, play it back through whatever chain you want and capture the output. Then, in the menu, you can go into "Import" and select measurement sweep. After that, provide both original and recording. $\endgroup$
    – jojeck
    Commented Mar 13, 2023 at 8:05
  • $\begingroup$ @jojek actually, dynamics processors are not usually time variant. A time-shifted input produces an output with the same time-shift. The envelope follower and its modulation of the output gain is non-linear, however. $\endgroup$
    – Jazzmaniac
    Commented Mar 16, 2023 at 11:08

1 Answer 1


I assume you are using the Exponential Sine Sweep (ESS) method introduced by Angelo Farina which Room EQ Wizard (I assume this is your REW software) uses for measurements.

The Method

The "mathematical idea" behind the use of the technique is similar (if not identical) to the Maximum Length Sequence (MLS) and the Time Domain Spectroscopy (TDS) (TDS is very similar to ESS with the former using a sine whose frequency changes linearly with time). The idea behind all those methods is to measure a Device Under Test (DUT) (which of course can be any system modelled as a "device") with a specific signal. The result of the measurement will be the convolution of the measurement signal and the impulse response of the DUT. This is shown mathematically in equation \ref{1} below

$$ y \left( t \right) = x \left( t \right) * h \left( t \right) \tag{1} \label{1} $$

where $*$ denotes convolution and $h \left( t \right)$ is the impulse response of the DUT. The same operation (convolution) can be performed in the frequency domain like

$$ \mathcal{FT} \left\{ y \left( t \right) \right\} = \mathcal{FT} \left\{ x \left( t \right) \right\} \mathcal{FT} \left\{ h \left( t \right) \right\} \implies Y \left( \omega \right) = X \left( \omega \right) H \left( \omega \right) \tag{2} \label{2}$$

with $\mathcal{FT}$ denotes the Fourier Transform and $\omega$ is the radial frequency for which $\omega = 2 \pi f$ is true with $f$ being the temporal frequency.

The next step is to deconvolve the measurement signal from the measurement result so that we are left with the impulse response of the DUT. The easiest way to do that is in the frequency domain like shown in equation \ref{3}. Starting from equation \ref{2} and solving for the transfer function (actually the frequency response of the impulse response) we get

$$ Y \left( \omega \right) = X \left( \omega \right) H \left( \omega \right) \implies H \left( \omega \right) = \frac{Y \left( \omega \right)}{X \left( \omega \right)} \tag{3} \label{3}$$

Then, by applying the Inverse Fourier Transform operator to the transfer function we end up with the impulse response (time-domain) of the DUT. This is shown in equation \ref{4} below.

$$ h \left( t \right) = \mathcal{IFT} \left\{ Y \left( \omega \right) \right\} \tag{4} \label{4}$$


Now, regarding the MATLAB code to achieve that. I assume you already have some of the variables/data you need and I'll make this explicit in the code with comments. One way to achieve that is the following, where equations \ref{3} and \ref{4} are directly implemented.

% x is the sweep used for the measurement
% y is the measurement (output of the DUT when excited with the sweep)

% Here I assume the length of the measurement vector is adequately long to avoid aliasing artifacts from the DUT's impulse response
X = fft(x, length(y)); % Input signal in frequency domain
Y = fft(y); % Output signal in frequency domain

% Calculate the transfer function
H = Y./X; % Transfer function (frequency-domain)

% Go back to time domain
h = ifft(h); % Impulse response (time-domain)
fftshift(h); % This is needed due to the implementation of the FFT algorithm

Additional information

Probably the most important thing to consider here is the deconvolution process and most specifically the inversion of the sweep (calculation of the deconvolution filter). Taking another look at equation \ref{3} you'll realise that in order to get the transfer function you have to divide by the frequency response of the input signal (this is the sweep). To provide some more insight, this is equivalent to convolving (thus, multiplying in the frequency domain) with the inverse of the sweep (effectively inverse filtering the output signal). This can be expressed also as

$$ Y \left( \omega \right) = X \left( \omega \right) H \left( \omega \right) \implies H \left( \omega \right) = Y \left( \omega \right) \frac{1}{X \left( \omega \right)} \tag{5} \label{5}$$

where $\frac{1}{X \left( \omega \right)}$ is the inverse filter that performs the deconvolution process you are after. If any of the frequency bins has a zero, or very small (or possible a very high) value then you'll end up introducing high numerical errors and the inversion will not be correct. In the best case scenario, if this happens, you'll end up with something completely wrong which will be easy to identify. In the worst case, the errors will not be extreme and will be very hard to spot and you'll have to resort to evaluation methods, of which the easiest is to compare with some known DUTs measured with some qualified and completely characterised system.

  • $\begingroup$ As an extra note, I strongly suggest you have a look at @jojek's answer linked to a comment in your question as it provides a very good and more (numerically) robust way to calculate the inverse filter. $\endgroup$
    – ZaellixA
    Commented Mar 13, 2023 at 10:29

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.