On Wednesday, 29 September 1999, "Shamus" writes:

> Ok, I think I get it.  The parser, when it sees something like 'd-dim' sets
> 'tonic' in Chord::Chord to 'D' and 'add_arr_p' to 'Ab' somewhere in the
> array.  There's a small problem with this approach, namely that the chord
> modifiers need to modify more than one pitch (e.g., diminished triad has
> *both* a flat third and flat fifth, seventh chords are even hairier) and

Hmm.  We may have to separate the modifiers from the additions, that
seems best.  We'll make a class Chord_modifier, and pass a list of those
to Chord ().

> they need to be separate from the other adds (if there are any).  I can work
> around this, if I know where in the array 'add_arr_p' the chord modifier is
> going (although I may be able to work around it anyway by setting the octave
> to something absurd).
> 
> >Why?  The maj may be a problem (what is maysix?).  But c-aug is really
> >the same as c-5+, so why not have aug mean 5+?
> 
> I guess to make it easier to understand what's being input.  (BTW, majsix
> would be a CM6, which is a major triad with an added sixth; its counterpart
> would be Cm6 which is a minor triad with an added sixth.)  It would be
> output as Caug as I've heard some complaining about things like C+ and C(#5)
> (although C(#5) should be allowed as output--I'm not sure how to handle
> *that* yet).  The whole idea is to keep a list of standard chord types that
> the user can enter and have the program interpret those names as pitches
> (for printing on the staff) or as (simply enough) a chord name.  Adds and
> subtracts would still be there so that those who are entering their weird
> jazz chords (like C9(b5)add#13) could still do so.
> 
> >We *must* have a separator.  Look at the lexer: it looks for strings, and
> >then checks whether it's a note name (c, cis, Cisis, ..), or a modifier.
> >If not, it returns a string to the parser.  'Cmaj6' looks as the string
> >'Cmaj' and the digit 6.
> 
> 
> How would one change the separator to a colon then?

parser.yy:1462:

    chord:
            steno_tonic_pitch optional_notemode_duration chord_additions chord_subtr
    actions chord_inversion {
                    $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
            };


So, first we have tonic, then duration (optional), then additions ...

    chord_additions: 
            {
                    $$ = new Array<Musical_pitch>;
            } 
            | CHORD_MINUS chord_notes {
                    $$ = $2;
            }
        ;

Additions may be empty, or be CHORD_MINUS ...

CHORD_MINUS must be colon, or ':', see what' being used elsewere in parser.
Also, have a look at the lexer, where it produces CHORD_MINUS, and what
the difference is with plain '-'.

Jan.

-- 
Jan Nieuwenhuizen <[EMAIL PROTECTED]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien/      | http://www.lilypond.org/

Reply via email to