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

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