clear all
[filename,pathname] = uigetfile( ...
{'*.wav', 'Zvukové soubory (*.wav)';
'*.wav', 'Wave (*.wav)';...
'*.*', 'Vsechny soubory (*.*)'},...
'Vyber soubor');
[pathstr,name,ext,versn] = fileparts(filename);  
[x,Fvz]=wavread(fullfile(pathname,filename));

ts=length(x)/Fvz;
m=0.50;
fz=0.7;
Ms=200;
dry=0.5;
wet=0.3;
g=0.5;

sim('TV_delay_sim')


close all

[save_file,save_path] = uiputfile('*.wav','Uložit jako',[name,'_flanger']);
savefile = [ save_path,save_file];
wavwrite(y(1,:),Fvz,savefile);

specgram(y,1024,Fvz,hamming(1024),512);

title(['Závislost: {\bfSG}, Funkce: {\itSG}({\itt},{\itf}), Parametry: {\itM}_s = ', ...
    num2str(Ms), ...
    ', {\itf}_z = ', ...
    num2str(fz), ...
    ', {\itm} = ', ...
    num2str(m), ...
    ', {\itdry} = ', ...
    num2str(dry), ...
    ', {\itwet} = ', ...
    num2str(wet), ...
    ', {\itg} = ', ...
    num2str(g)])
xlabel('{\itt} (s) \rightarrow');
ylabel('{\itf} (Hz) \rightarrow');
text(5.2,-1500,'{\itSG} (dB) \downarrow');
caxis([-70 20]);
colormap('Jet')
colorbar
set(gca,'layer','top','box','on')
