Contents
Wave sound
fprintf('tunable bandpass and hbandstop filters \n')
[x,fs,nbits] = wavread('handel');
fprintf('sampling frequency = %g kHz \n',fs/1000)
tunable bandpass and hbandstop filters
sampling frequency = 8.192 kHz
Default filtering
beta = 0; alpha = 0;
[u,v] = latc1m([-beta,alpha],x);
ybs = .5*(x + v');
ybp = .5*(x - v');
Main menu
MAIN_LOOP = 21; END = 'false';
while MAIN_LOOP > 0
MAIN_LOOP = MAIN_LOOP - 1;
MAIN = menu('Select','filtering','graphics','sound','END');
switch MAIN
case 1
dlg_title = 'Input for tunable filters';
prompt = {'Enter -1 < alpha < 1','Enter -1 < beta < 1'}; num_lines = 1; def = {'0','0'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
alpha = str2num(answer{1});
beta = str2num(answer{2});
[u,v] = latc1m([-beta,alpha],x);
ybs = .5*(x + v');
ybp = .5*(x - v');
case 2
[FIG1, FIG2] = lab9_demo2_graphics(x,v,ybs,ybp,alpha,beta,fs);
case 3
lab9_demo2_playsound(x,v,ybs,ybp,fs,nbits)
otherwise
END = 'true';
end
if strcmp(END,'true') break, end
end