Mercurial > hg > c4dm-chord-transcriptions
diff evaluationtools/mxmap.m @ 1:8973548174c1 tip
adding tools to repo
author | christopherh |
---|---|
date | Mon, 06 May 2013 14:43:47 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/evaluationtools/mxmap.m Mon May 06 14:43:47 2013 +0100 @@ -0,0 +1,38 @@ + +% map chord to mirex integer representation + +function [val,success] = mxmap(chord, year) + +success = 1; +errormessage = ''; + +[rootnote, shorthand,intervals, bassinterval, success, errormessage] = getchordinfo(chord); + +if strcmp(rootnote,'N') + + val = 24; + +else + if success + [val, success, errormessage] = note2pitchclass(rootnote); + end + + if success + switch year + + case 8 + if ~isempty(strfind(shorthand,'min')); + val = val+12; + end + case 9 + if ~(isempty(strfind(shorthand,'min')) & isempty(strfind(shorthand,'dim')) & isempty(strfind(shorthand,'sus2'))); + val = val+12; + end + otherwise + success = 0; + errormessage = 'Error in mxmap: invalid year\n'; + + end + end + +end \ No newline at end of file