lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Question -- verse and chorus


From: Carl D. Sorensen
Subject: Re: Newbie Question -- verse and chorus
Date: Tue, 12 May 2009 06:36:22 -0600



On 5/12/09 4:44 AM, "Tim Rowe" <address@hidden> wrote:

> 
> Now on to my next exercise -- working out how to print capo chords in
> parentheses after the regular chord, so I get:
>   (capo 3)   C (A)   G7 (E7)
> The nearest I can find is at
> http://www.mail-archive.com/address@hidden/msg24850.html, but
> that does them on different rows and without parentheses.
> 

To do this on double rows is not too hard.  I made it easier by developing a
parenthesizeAll function.

(I haven't put in the instrument name or the instrument_name_engraver that
was in the archives, but I think you can do that).

parenthesizeAll =
#(define-music-function (parser loc myMusic) (ly:music?)
  (music-map
    (lambda (ev)
      (if (or (memq 'note-event (ly:music-property ev 'types))
              (memq 'rest-event (ly:music-property ev 'types)))
          (set! (ly:music-property ev 'parenthesize) #t))
      ev)
    myMusic)
  myMusic)


mychords = \chordmode {
  c1 g1 c1
}

<<
  \new ChordNames {
    \mychords
  }
  \new ChordNames {
    \parenthesizeAll
      \transpose c a {\mychords}
  }
>>


Doing the two side-by-side will be a bit harder, because we'll need to
figure out a scheme for the timing.  My initial thought was to just cut the
duration in half and add a \parenthesize{\transpose {}}.  But this would be
really ugly if the chords were full duration.  For example, if each chord
were a whole note, then the capo chords would be off half a measure from the
regular chords.  Further, that scheme would mess up the chordChanges
behavior.

So I think the best way to go is to just mess with the chordNames function.
If I recall correctly, in the last year or so somebody posted on the list a
transposition function for chord names.  You might be able to make that work
and to create a new chord name creation function that would create the chord
name, transpose it, and then combine the two with the second one in
parentheses.  This would require Scheme knowledge.

Anyway, I hope this has been helpful.

Carl

P.S.  It's generally a good idea to start a new thread when you change the
topic; it helps in archive searches later.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]