|
mié 14-abr-2004 21:40
%Flanger
%Vikas Sahdev
%Rajani Shankar
%Rajesh Samudrala
%
[x,fs,n]=wavread('dt.wav');%read in wav file
xlen=length(x);%Calc. the number of samples in the file
%Initialize constants
a=0.5;
D=2500;%Calculate the number of samples in the delay
y=zeros(size(x));
delay = zeros(size(x));
cycle=1/2;
% filter the signal
for i=1:1:D+1
y(i) = x(i);
end;
for i=D+1:1:xlen
delay(i) = abs(round(D * cos(2*pi*i/((xlen-D-1)/cycle))));
y(i)= x(i)+a*x(i-delay(i));
end;
wavwrite(y,fs,'flang2.wav')
figure(1);
plot(delay);grid;
title('The delay function beta(n)');
|