view 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 source

% 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