# Time-spread multiple echoing of audio signals

I have been reading papers related to adding echos into digital audio signals recently. I guess I understood the logic behind, yet I guess I am still having lack of DSP knowledge to figure out everything.

In order to add a single echo delay $\Delta$ into audio signal $S$ using convolution operator, echo kernel $k(n)$ is defined as:

$$k(n)= \delta [n] + \alpha \cdot \delta [n-\Delta]$$

where $\delta [n]$ is Kronecker Delta Function, and $0 < \alpha \ll 1.$

Echoed sound signal $S'$ calculated using convolution operator "$*$" as:

$$S'=S \ * k(n)$$

I have no problems until this part. My question is based on this publication, [Ko, Nishimura, Suzuki - 2005]. It is based on echo data hiding for audio watermarking (steganography), but a very good source to understand sound echos. Authors say that multiple echos provide better quality for HAS than single echos (see Fig. 1.) A pseudorandom sequence is generated to spread multiple echos in time. I generate it in MATLAB with the following code:

rand('seed', key);         % set seed of random sequence
a = rand(length, 1);
prseq = (a > 0.5)*2-1;     % convert into -1 and +1


In next step, time-spread echo kernel is defined using PN Sequence as: (see Fig. 2.)

$$k(n)= \delta [n] + \alpha \cdot P[n-\Delta], 0 < \alpha \ll 1$$ Schemetic explanation is made in Fig. 3. below: I tried this tecnique in MATLAB and I actually have two questions:

1. Audio signal is being corrupted when the number of echos increases no matter how small $\alpha$ value is chosen. In the same article length of PN Sequence is chosen as $1023$, and delay = 1 ms which is about 44 samples in 44.1 kHz audio signal. So how is it possible to provide "a real room" echos as it is said in the article? Do I miss anything?

I am adding my summarized MATLAB codes:

delta = 44;
alpha = 0.02;

% Single echo kernel
for n=1:delta+1
k_single(n) = kdelta(n-1) + alpha*kdelta(n-delta-1);
end

% Time-spread echo kernel without using kronecker delta:
kernel = [1 zeros(1,delta-1) alpha*prseq'];

echoed = conv(audio_data, kernel);

function [ out ] = kdelta( x )
out = double((x==0));
end


Alternatively:

single_echo = signal + alpha*[zeros(1,delta) signal(1:length(signal)-delta)];

1. I was adding echos in an audio signal by shifting and adding as I mentioned above "alternatively". I figured out that it would take so much time to use it for multiple echos, so I thought I had to use convolution. But conv(x,y) function in matlab changing data size up to length(x)+length(y)-1 according to definition of convolution. Is it a good idea to just to crop it like echoed(1:length(audio_data)) to keep the length fixed? What is best option to accomplish multiple echoing as fast as possible and using less memory?

Excuse me for such a long question. I wanted to explain my problem in details, so it made my question longer.

• What are you actually trying to achieve, an acoustic effect or a watermarking technique as outlined in that paper? For an acoustic effect what you are really describing is known as reverb, which is related to echo but also deals with sound reflections in a more generalised sense. – PAK-9 Mar 3 '17 at 14:23
• @PAK-9 thanks for the comment. I actually wanted to achive watermarking technique, but I have no problems with watermarking using echo-hiding technique. Few echos look fine in audio signal, almost imperceptible, and I am able to extract watermarks back. So my question was about using convolution operator and how so many echos give a better sound quality according to article. Sound gets corrupted when I try to add that many echos in matlab... – kdrtkl Mar 3 '17 at 15:34 • About second question: Tail from echo kernel is very small, but what is the best method to keep original signal and echoed signal same sized? Is it fine to convolve them like: x1 = conv(signal,kernel) and then crop it like x2 = x1(1:length(signal)) ?? It just seems like amateurish, that's why I asked this question. There may be another smarter way to do same process. – kdrtkl Mar 3 '17 at 20:02