

E_directory = '/media/data/matlab-work/mirex_results/converted';

A_directory = '/media/data/beatles chord transcriptions 1.3/';

results_dir = '/media/data/matlab-work/mirex_results/recall1' 


folders = {'de','ko1','ko2','md','ogf1','ogf2','pp','pvm1','pvm2','rrhs1','rrhs2','rrhs3'};

beatles_A_names = readlist('beatles_A_paths.txt');

beatles_E_names = readlist('beatles_names.txt');

outtext = '';

folder_number = length(folders);
song_number = length(beatles_A_names);

paramasarray = [];

%tests to run:


% TEST1

% set the recall parameters
params.framerate = 100; %fps 10ms frames
params.comparison = 'mx08'; 
params.cardinality = 3; 
params.inversion = 0;
params.dictionary = {};% {'N', 'X:maj', 'X:min', 'X:dim', 'X:aug'};

paramsarray = [paramsarray params];


% TEST2

% set the recall parameters
params.comparison = 'mx09'; 
params.cardinality = 3; 
params.inversion = 0;
params.dictionary = {};% {'N', 'X:maj', 'X:min', 'X:dim', 'X:aug'};

paramsarray = [paramsarray params];

% TEST3

% set the recall parameters
params.comparison = 'op'; 
params.cardinality = 3; 
params.inversion = 0;
params.dictionary = {};% {'N', 'X:maj', 'X:min', 'X:dim', 'X:aug'};

paramsarray = [paramsarray params];

% TEST4

% set the recall parameters
params.comparison = 'op'; 
params.cardinality = 2; 
params.inversion = 0;
params.dictionary = {};% {'N', 'X:maj', 'X:min', 'X:dim', 'X:aug'};

paramsarray = [paramsarray params];

% TEST5

% set the recall parameters
params.comparison = 'op'; 
params.cardinality = 3; 
params.inversion = 0;
params.dictionary = {'N', 'X:maj', 'X:min'};

paramsarray = [paramsarray params];


% TEST6

% set the recall parameters
params.comparison = 'op'; 
params.cardinality = 2; 
params.inversion = 0;
params.dictionary = {'N', 'X:maj', 'X:min'};

paramsarray = [paramsarray params];



for index = 1:numparams
    
    params = paramsarray(index);
    
    results = zeros(folder_number,song_number,2);

    time_resolution = 1/params.framerate; % recall time resolution = 1/fps

    for i = 1:folder_number

        % for each folder


        for j = 1:song_number

            % get current annotation file
            annotations_labfile = [A_directory '/' beatles_A_names{j}]

            % get current labfile
            estimates_labfile = [E_directory '/' folders{i} '/' beatles_E_names{j}];

            % sample at specified frame rate
%            annotation_frames = lab2frames(annotations_labfile, time_resolution);
%            estimate_frames = lab2frames(estimates_labfile, time_resolution);

            % calculate recall
%            [recall, non_dictionary] = getrecall2(estimate_frames, annotation_frames, params);

            [recall, non_dictionary] = getrecall3(estimates_labfile, annotations_labfile, params);

            %[segmeasure, m, f] = getsegmeasure(annotation_labfile, estimates_labfile)

            results(i,j,1) = recall;
            results(i,j,2) = non_dictionary;

        end


    end

    outtext = format_recall_results(results, params, folders, beatles_A_names);

    printfile(outtext, [results_dir '/recall-' datestr(now,'yyyy-mm-dd') '-' params.comparison '.txt']);

end

