idamnjanovic@8: function AMT_res = AMT_analysis(Problem, solver) idamnjanovic@8: %%% Automatic Music Transcription results analysis idamnjanovic@24: % idamnjanovic@8: % If wav file that is transcribed is generated from midi file (i.e. if idamnjanovic@8: % groundtruth exists) transcription is comapred to the original notes and idamnjanovic@8: % AMT_res structure is generated. It contains following fields: idamnjanovic@8: % - tp_notes - true positive notes (notes corectly transcribed) idamnjanovic@8: % - oe_notes - octave errors (erroes due to imperfect pitch estimation) idamnjanovic@8: % - fn_notes_wo_oe - false negative notes without octave errors idamnjanovic@8: % (notes that were not detected) idamnjanovic@8: % - fp_notes_wo_oe - false positive notes without octave erors idamnjanovic@8: % - TP - number of true positives idamnjanovic@8: % - FN - number of false negatives idamnjanovic@8: % - FP - number of false positives idamnjanovic@8: ivan@107: % ivan@107: % Centre for Digital Music, Queen Mary, University of London. ivan@107: % This file copyright 2009 Ivan Damnjanovic. ivan@107: % ivan@107: % This program is free software; you can redistribute it and/or ivan@107: % modify it under the terms of the GNU General Public License as ivan@107: % published by the Free Software Foundation; either version 2 of the ivan@107: % License, or (at your option) any later version. See the file ivan@107: % COPYING included with this distribution for more information. ivan@107: %% ivan@107: idamnjanovic@8: timeOr=Problem.notesOriginal(:,5); idamnjanovic@8: noteOr=Problem.notesOriginal(:,3); idamnjanovic@8: timeTr=solver.reconstructed.notes(:,5); idamnjanovic@8: noteTr=solver.reconstructed.notes(:,3); idamnjanovic@8: n=size(timeOr,1); idamnjanovic@8: m=size(timeTr,1); idamnjanovic@8: idamnjanovic@8: % tolerance (ts) is set to one window before and after the reference offset idamnjanovic@8: % time idamnjanovic@8: idamnjanovic@8: ts=(Problem.windowSize)/Problem.fs; idamnjanovic@8: idamnjanovic@8: Hits=[]; idamnjanovic@8: OE=[]; idamnjanovic@8: idamnjanovic@8: for i=1:n idamnjanovic@8: Hit= find((noteTr(:)==noteOr(i))&(abs(timeOr(i)-timeTr(:))1 Hit=Hit(1); end idamnjanovic@8: if ~isempty(Hit) Hits=[Hits; i , Hit]; idamnjanovic@8: else idamnjanovic@8: OctErr=find(((noteTr(:)==noteOr(i)-12)|(noteTr(:)==noteOr(i)-24))&(abs(timeOr(i)-timeTr(:))