annotate evaluationtools/striproot.m @ 1:8973548174c1 tip

adding tools to repo
author christopherh
date Mon, 06 May 2013 14:43:47 +0100
parents
children
rev   line source
christopherh@1 1
christopherh@1 2 function chord = striproot(chordinput,rootc)
christopherh@1 3
christopherh@1 4 if nargin<2
christopherh@1 5 rootc=0;
christopherh@1 6 end
christopherh@1 7
christopherh@1 8
christopherh@1 9 [rootnote, shorthand, intervals, bass, success, errormessage] = parsechord(chordinput);
christopherh@1 10
christopherh@1 11 if strcmp(rootnote, 'N')
christopherh@1 12 chord = 'N';
christopherh@1 13 else
christopherh@1 14 if isempty(shorthand) && isempty(intervals)
christopherh@1 15 chord = 'X';
christopherh@1 16 elseif isempty(intervals)
christopherh@1 17 chord = ['X:' shorthand];
christopherh@1 18 elseif isempty(shorthand)
christopherh@1 19 chord = ['X:(' intervals ')'];
christopherh@1 20 else
christopherh@1 21 chord = ['X:' shorthand '(' intervals ')'];
christopherh@1 22 end
christopherh@1 23
christopherh@1 24 if ~isempty(bass)
christopherh@1 25 chord = [chord '/' bass];
christopherh@1 26 end
christopherh@1 27
christopherh@1 28 if rootc
christopherh@1 29 chord(1) = 'C';
christopherh@1 30 end
christopherh@1 31 end
christopherh@1 32
christopherh@1 33