lilypond-user
[Top][All Lists]
Advanced

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

Re: Coloring note heads by pitch


From: Trevor Daniels
Subject: Re: Coloring note heads by pitch
Date: Mon, 2 Nov 2009 19:27:42 -0000

Hi Chris

Does the example in the Learning Manual help? I think it does exactly what you want. See section 4.6.6.

Trevor

----- Original Message ----- From: "Chris Angelico" <address@hidden>
To: <address@hidden>
Sent: Monday, November 02, 2009 7:05 PM
Subject: Coloring note heads by pitch


I've spent some time trying to figure this out, and I'm certain it's
possible; the only question is, what's the cleanest way to do it?

I want to print out score with each note color coded (middle C in red, D in orange, E in green) to match a set of bells. Currently, I have a fairly straightforward setup, but exceedingly tedious: identify the
bell AND give the music expression. What I'd like to do is make it
that I can simply key in the music as is, and then have some
scriptwork figure out what color to make each one based on its
staffposition.

Current code:

% Is there an alternative to this shocking editor inheritance?
bell = #(define-music-function (parser location bellnum mus) (integer?
ly:music?)
   (if (eq? bellnum 1) #{ \once \override NoteHead #'color = #red
 \once \override Stem #'color = #red       $mus #}
(if (eq? bellnum 2) #{ \once \override NoteHead #'color = #orange
 \once \override Stem #'color = #orange    $mus #}
(if (eq? bellnum 3) #{ \once \override NoteHead #'color = #yellow
 \once \override Stem #'color = #yellow    $mus #}
(if (eq? bellnum 4) #{ \once \override NoteHead #'color = #green
 \once \override Stem #'color = #green     $mus #}
   (if (eq? bellnum 5) #{ \once \override NoteHead #'color =
#darkgreen \once \override Stem #'color = #darkgreen $mus #}
   (if (eq? bellnum 6) #{ \once \override NoteHead #'color = #cyan
 \once \override Stem #'color = #cyan      $mus #}
   (if (eq? bellnum 7) #{ \once \override NoteHead #'color =
#darkblue  \once \override Stem #'color = #darkblue  $mus #}
(if (eq? bellnum 8) #{ \once \override NoteHead #'color = #magenta
 \once \override Stem #'color = #magenta   $mus #}
   #{ #}
   )))))))))



... and inside the Voice:
% Every note must be entered as a bell identifier (#1
being the lowest bell, and #8 being the highest),
               % in addition to its note definition.
               s2
               \bell #1 c8(
               \bell #2 d8)
               \bell #3 e2
               \bell #3 e4
               \bell #5 g4.(
               \bell #4 f8)
               \bell #3 e4
               \bell #2 d4.(
               \bell #3 e8)
               \bell #4 f4
               \bell #3 e2
               r4

This is tedious and error-prone, as I have to give all information
twice. I'm pretty certain that my failure is due to my lack of
knowledge of the system, and that the experts on this list will be
able to offer a solution - maybe there's one already built and ready!

ChrisA
Hopeful in the trusting, rather than futile, sense! :)


_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user






reply via email to

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