function batchCENSComp
% Funkce pro vypocet Pitch parametru z nahravek
% Stepan Miklanek, 2018

DBpath = uigetdir;
DBinfo = dir(DBpath);
filenames = extractfield(DBinfo(3:end),'name');

nAudio = length(filenames);

mkdir(DBpath,'CENSFiles');

%%

for n = 1:nAudio
        
    currentFile = filenames{n};  
    filename = [DBpath,'\',currentFile];
    
    a = miraudio(filename,'Sampling',22050,'Mono',1);
    audio = mirgetdata(a);
    
    [~,name,~] = fileparts(filename);
    
    p = monoPitch(audio,4410);
    c = pitchCENS(p,44,1);
    
    savepath = [DBpath,'\CENSFiles\',name,'.mat'];
    
    save(savepath,'c')
        
end

end

