In: Electrical Engineering
Need explanation of MATLAB code which creates echo. (SIGNAL PROCESSING)
If the original audio signal is x(t) then the echo is y(t) = x(t) + alpha*x(t-delay)
This code below creates this echo however I don't understand how every line of the code works, could someone comment this code so I can understand?
[x,Fs] = audioread('Hallelujah.wav');
sound(x,Fs);
delay = 0.5; % 0.5s delay
alpha = 0.65; % echo strength
D = delay*Fs;
y = zeros(size(x));
y(1:D) = x(1:D);
for i=D+1:length(x)
y(i) = x(i) + alpha*x(i-D);
end