Contents
Wave sound
fprintf('tunable lowpass and highpass filters \n')
[x,fs,nbits] = wavread('handel');
fprintf('sampling frequency = %g kHz \n',fs/1000)
tunable lowpass and highpass filters
sampling frequency = 8.192 kHz
Default filtering
alpha = 0;
[u,v] = latc1m(-alpha,x);
ylp = .5*(x + v');
yhp = .5*(x - v');
Main menu
MAIN_LOOP = 11; 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'}; num_lines = 1; def = {'0'};
answer = inputdlg(prompt,dlg_title,num_lines,def);
alpha = str2num(answer{1});
[u,v] = latc1m(-alpha,x);
ylp = .5*(x + v');
yhp = .5*(x - v');
case 2
[FIG1, FIG2] = lab9_demo_graphics(x,v,ylp,yhp,alpha,fs);
case 3
lab9_demo_playsound(x,v,ylp,yhp,fs,nbits)
otherwise
END = 'true';
end
if strcmp(END,'true') break, end
end