lilypond-user
[Top][All Lists]
Advanced

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

Re: entering chords


From: MING TSANG
Subject: Re: entering chords
Date: Mon, 24 Mar 2014 16:03:24 -0700 (PDT)

Thomas,
WOW! Thank you very much.  Can this be adapted to <<{..1..}\\{..2..}>> construct - upper color or lower color?  
Emmanuel,
Ming.


On Monday, March 24, 2014 5:04:13 PM, Thomas Morley <address@hidden> wrote:
2014-03-24 0:02 GMT+01:00 MING TSANG <address@hidden>:
>
>
> The sample clr you provide does not output exactly what I am looking.  I am
> looking for a "function" that will tweak the first enter pitch to have color
> for all the <..> entries not all the pitch inside the <..> to have the same
> color.

How about below?
Also, I added an optional argument, which you can use to specify which
chord-note should be colored.
Default is 'first'.
It's possible to switch to 'last'.
Other settings like 'fourth' at own risk:
Ofcourse specifying 'fourth' will result in an error, if any chord has
not enough notes.

\version "2.18.0"

clr =
#(define-music-function (parser location which color music)
    ((procedure? car) color? ly:music?)
  (music-map
    (lambda (mus)
      (if (music-is-of-type? mus 'event-chord)
          (let* ((evt-chrd-nts (event-chord-notes mus)))
          (if (> (length evt-chrd-nts) 1)
              (let ((first-nh (which evt-chrd-nts)))
                #{ \tweak #'color #color #first-nh #})
              mus)
            mus)
          mus))
    music))

myMusic =
\relative c' {
        <c e g>4-!
        <d e f>^"xy"
        <e-1>
        f---2^"foo"
}

\new Staff \clr #red \myMusic
\new Staff \clr #last #green \myMusic
\new Staff \clr #second #yellow \myMusic


Cheers,
  Harm



reply via email to

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