annotate evaluationtools/mxmap.m @ 1:8973548174c1 tip

adding tools to repo
author christopherh
date Mon, 06 May 2013 14:43:47 +0100
parents
children
rev   line source
christopherh@1 1
christopherh@1 2 % map chord to mirex integer representation
christopherh@1 3
christopherh@1 4 function [val,success] = mxmap(chord, year)
christopherh@1 5
christopherh@1 6 success = 1;
christopherh@1 7 errormessage = '';
christopherh@1 8
christopherh@1 9 [rootnote, shorthand,intervals, bassinterval, success, errormessage] = getchordinfo(chord);
christopherh@1 10
christopherh@1 11 if strcmp(rootnote,'N')
christopherh@1 12
christopherh@1 13 val = 24;
christopherh@1 14
christopherh@1 15 else
christopherh@1 16 if success
christopherh@1 17 [val, success, errormessage] = note2pitchclass(rootnote);
christopherh@1 18 end
christopherh@1 19
christopherh@1 20 if success
christopherh@1 21 switch year
christopherh@1 22
christopherh@1 23 case 8
christopherh@1 24 if ~isempty(strfind(shorthand,'min'));
christopherh@1 25 val = val+12;
christopherh@1 26 end
christopherh@1 27 case 9
christopherh@1 28 if ~(isempty(strfind(shorthand,'min')) & isempty(strfind(shorthand,'dim')) & isempty(strfind(shorthand,'sus2')));
christopherh@1 29 val = val+12;
christopherh@1 30 end
christopherh@1 31 otherwise
christopherh@1 32 success = 0;
christopherh@1 33 errormessage = 'Error in mxmap: invalid year\n';
christopherh@1 34
christopherh@1 35 end
christopherh@1 36 end
christopherh@1 37
christopherh@1 38 end