This is just an outline of what I did (assume that all my dimensions fit):

    (code that imports audio to read audio as function x)
    (code to define time t and frequency f)

    % This is where it gets tricky 
    % In the frequency domain I have the function above where f is the frequency 
    % variable and L M N O P are arbitrary values

    % again assume dimensions fit

    %Taking the inverse fft and fftshift was the only way I could get back a signal
    % Once again assume the dimensions fit 

Here L M N O P = [.9 .75 1.0 .5 .5]

signal x with respect to time

output y with respect to time

Is this legit? or am I just pulling my own leg? Is it an actual "echo?" Or am I just manipulating the signal to make it seem like an echo?

  • $\begingroup$ +1 for absolutely ridiculous ASCII plots without any description. One more vote and you will get 11 points... $\endgroup$
    – jojeck
    Commented Jul 19, 2014 at 11:54
  • $\begingroup$ By duality, multiplying by a complex sinusoid in the time domain is equivalent to convolving with a delta in the time domain (shift in time), so, yes, I'd expect this to be an echo. Note that it's a shift in a circular time axis, so it will shift in from the start if it goes off the end. H consists of three complex sinusoids (at zero, N, and P cycles per window), so I'd actually expect three images. Not sure where the time reversed image comes from. fftshift seems not appropriate. $\endgroup$
    – dpwe
    Commented Jul 19, 2014 at 15:23
  • $\begingroup$ @dpwe thank you. I also would expect three signals and do not know where the time reversed comes from. I will update when I get to that point. $\endgroup$ Commented Jul 19, 2014 at 19:42
  • $\begingroup$ Thank you! I finally got three time shifted signals. There is quite a bit of noise though. $\endgroup$ Commented Jul 20, 2014 at 3:48

2 Answers 2


To generate a repetitive echo all you need to do is pass your signal through an appropriate AR filter with a delay corresponding to the echo period. For instance the following code generates (for a damped 1 Hz sinusoid sampled at 100 Hz) an echo which repeats every 1000 samples. The strength of the echo can be adjusted by the AR filter coefficient (0.5 here)

Example Matlab code

% generate 10000 samples of a damped sinusoid at 100 Hz
sig = sin(2*pi*(0:9999)/100).*exp(-(0:9999)/200);

% AR filter to generate a repetitive echo, period 1000 samples (10 seconds)
b = 1;
a= [1 zeros(1,999), 0.5];

echo = filter(b,a,sig);

You may want to experiment with your AR filter to match your echo decay. Also look into 'gapped deconvolution' enter image description here


Addendum to my earlier post - the AR model for echo generation leads to an infinite number of echos (most of them damped out after a while depending upon the filter coefficient). To generate a finite number of echos use the MA approximation to the AR model, which is:

$$H(z) = \frac{1}{1 - az^{-N}}$$

where $|a| < 1.0$, and $N$ is the reverberant delay in samples.

The MA approximation (series expansion) of the AR transfer function $H(z)$ is

$$H_{MA}(z) = 1 + az^{-N} + a^2z^{-2N} + \ldots$$

So, for instance, to generate just one echo you may want to just filter your signal through an MA filter of the form

$$H_{MA}(z) = 1 + az^{-N}$$

To generate two unequally spaced echoes with differing intensities you could, for example, use an MA filter of the form

$$H_{MA,2}(z) = 1 + az^{-N} + bz^{-M}$$

The Matlab code below generates (a) one echo and (b) two unequally spaced echoes

% generate 10000 samples of a damped sinusoid at 100 Hz
sig = sin(2*pi*(0:9999)/100).*exp(-(0:9999)/200);

% MA filter to generate an echo beginning at 1000 samples (10 seconds)
a = 1;
b= [1 zeros(1,999), 0.5];

% generate echo
reverb1 = filter(b,a,sig);

% MA filter to generate two echos beginning at samples 1000 and 3000
a = 1;
b= [1 zeros(1,999), 0.5 zeros(1,1999) 0.25];

% generate signal with 2 echoes
reverb2 = filter(b,a,sig);

The figure below shows the original signal and the signal with echoes suprimposed from the Matlab outputenter image description here

  • $\begingroup$ Why not to edit the original answer and join it together, instead of posting from multiple accounts? $\endgroup$
    – jojeck
    Commented Jul 25, 2014 at 7:45

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.