view evaluationtools/striproot.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

function chord = striproot(chordinput,rootc)

if nargin<2
    rootc=0;
end


    [rootnote, shorthand, intervals, bass, success, errormessage] = parsechord(chordinput);

    if strcmp(rootnote, 'N')
            chord = 'N';   
    else
            if isempty(shorthand) && isempty(intervals)
                chord = 'X';
            elseif isempty(intervals)
                chord = ['X:' shorthand];
            elseif isempty(shorthand)
                chord = ['X:(' intervals ')'];
            else
                chord = ['X:' shorthand '(' intervals ')'];
            end

            if ~isempty(bass)
                chord = [chord '/' bass];
            end
     
            if rootc
                chord(1) = 'C';
            end
    end