www.pudn.com > 305-matlabCode.zip > mecho1_m.m
%PROJECT: AUDIO SIGNAL PROCESSING
%IMPLEMENTATION OF MULTIPLE ECHO EFFECT IN THE AUDIO SIGNAL
%mecho1 FUNCTION
%PROJECT BY:
function y = mecho1_m();
[x,fs,nbits]=wavread('wav_2.wav');%read in wav file
xlen=length(x);%Calc. the number of samples in the file
% the ratios for attenuation
a0=0.9;
a1=0.8;
a2=0.7;
%calculate no of samples for delay greater than 50 ms
R=ceil(fs*120e-3);
len=size(x)+3*R;
y=zeros(1,len);
% filter the signal
x=x';
d0=[zeros(1,R) x zeros(1,2*R)]; d0=a0*d0;
d1=[zeros(1,2*R) x zeros(1,R)];d1=a1*d1;
d2=[zeros(1,3*R) x];d2=a2*d2;
for i=1:1:R+1
y(i) = x(i);
end
y=[x zeros(1,3*R)] + d0 +d1 +d2;