Chord Parser
The chord is of the form
<root><type>[<modifiers>][/<bass>] where:
- <root> is an uppercase note (A-G) followed by a # or b.
- <type> is either 'm' (minor), 'dim' (diminished), 'aug' (augmented)
or nothing (major)
- <modifiers> can be bracketed if necessary, and be one or more of
- a suspension - 'sus4' (or 'sus' for short) or 'sus2': e.g. Csus4
- an extension - a scale degree (6,7,9,11,13) to make a sixth, seventh, etc chord e.g. D7, E13. Extensions from 7 upwards may optionally be preceeded by a 'M' for a major 7th.
- an alteration: an accidental followed by a a scale degree (5,6,7,9,11,13) e,g, in D13b9, the b9 is an alteration
- an addition - 'add' followed by an optional accidental and a scale degree (7,9,11,13): e.g. Amadd9
- an omission - currently the only one supported is 'no3': e,g, Eno3
- <bass> is an uppercase note (A-G) optionally followed by a # or b
Note that in the output, 'x' means 'double sharp'.
Perl subroutine available from here.
Feedback to Mike Whitaker.