Mercurial > hg > c4dm-chord-transcriptions
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/evaluationtools/striproot.m Mon May 06 14:43:47 2013 +0100 @@ -0,0 +1,33 @@ + +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 + + \ No newline at end of file