christopherh@1: christopherh@1: % map chord to mirex integer representation christopherh@1: christopherh@1: function [val,success] = mxmap(chord, year) christopherh@1: christopherh@1: success = 1; christopherh@1: errormessage = ''; christopherh@1: christopherh@1: [rootnote, shorthand,intervals, bassinterval, success, errormessage] = getchordinfo(chord); christopherh@1: christopherh@1: if strcmp(rootnote,'N') christopherh@1: christopherh@1: val = 24; christopherh@1: christopherh@1: else christopherh@1: if success christopherh@1: [val, success, errormessage] = note2pitchclass(rootnote); christopherh@1: end christopherh@1: christopherh@1: if success christopherh@1: switch year christopherh@1: christopherh@1: case 8 christopherh@1: if ~isempty(strfind(shorthand,'min')); christopherh@1: val = val+12; christopherh@1: end christopherh@1: case 9 christopherh@1: if ~(isempty(strfind(shorthand,'min')) & isempty(strfind(shorthand,'dim')) & isempty(strfind(shorthand,'sus2'))); christopherh@1: val = val+12; christopherh@1: end christopherh@1: otherwise christopherh@1: success = 0; christopherh@1: errormessage = 'Error in mxmap: invalid year\n'; christopherh@1: christopherh@1: end christopherh@1: end christopherh@1: christopherh@1: end