--- Saving session to:
    ECE481_03-May-2002.txt
--- Processed startup.m ---
doc
; ; ; ; ; ; ; 
type comb1

function comb1(fname,td,g,varargin)
% Comb filter for reverberation

% Parameters
fs=10e3;			%sampling freq (Hz)
%td=10e-3;		%time delay (sec)
%g=0.9;			%gain coefficient


if nargin>3
    %input for impulse response
    x=zeros(1,fs*2);
    x(1)=1;
else
    %speech signal as input
    [x fs bits]=wavread(fname);
end

%filter coefficients
N=round(td*fs);
a=[1 zeros(1,N-1) -g];
b=[zeros(1,N) 1];

%generate the output
y=filter(b,a,x);

% Determine screen size
ssize = get(0,'ScreenSize');
swidth = ssize(3);
sheight = ssize(4);

% Need two figures to fit across top of screen; determine width of each figure
fwidth = swidth/2;
vpos=[sheight-(fwidth+20),fwidth,fwidth];

% Create the figures
f1=figure(1);
set(f1,'Position',[0 vpos],'Name','Frequency Response','MenuBar','none')

f2=figure(2);
set(f2,'Position',[swidth/2 vpos],'Name','Input / Output','MenuBar','none')

%play the input and output, and look at the results
figure(f1)
freqz(b,a)
zoom on

figure(f2)
subplot(2,1,1),plot(x),title('Input Waveform')
subplot(2,1,2),plot(y),title('Output Waveform')
drawnow
zoom on

x=x/max(abs(x));
y=y/max(abs(y));


wavplay(x,fs)
pause
wavplay(y,fs)

edit comb1
comb1('s6',10e-3,0.5,1)
comb1('s6',10e-3,0.5,1)
comb1('s6',10e-3,0.8,1)
comb1('s6',10e-3,0.95,1)
comb1('s6',1e-3,0.95,1)
comb1('s6',2e-3,0.95,1)
comb1('s6',20e-3,0.9)
comb1('s6',20e-3,0.5)
comb1('s6',20e-3,0.99)
comb1('s6',40e-3,0.8)
comb1('s6',400e-3,0.8)
comb1('s5',400e-3,0.8)
comb1('s5',10e-3,0.9)
comb1('s5',5e-3,0.9)
comb1('s5',1e-3,0.9)
exit