lilypond-user
[Top][All Lists]
Advanced

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

Re: Testing testing is there connection?


From: darkijah
Subject: Re: Testing testing is there connection?
Date: Thu, 13 May 2021 10:19:55 +0200
User-agent: Gigahost Webmail

I was toying around with colors yesterday and tuned this script to some color sanity :) C Red, D Orange, E Yellow and so forth although I would like to have a black line around the notes so there are more clearly seen - although not sure if this is possible, a work in progress. I do not know what it all does, but I did figure out the colors so I could make them fitting for the note. This Script will need further improvement and I will look into that with the help of the community. You activate it by putting \override NoteHead.color = #color-notehead inside the... well... I will make a small copy paste as I'm not sure what it is called, you can save it as color.ly and include it in your sheet and activate it:

Snippit >>>
\score {
  <<
    \new Staff {
      \new Voice = "sang" {
        \relative d' {
  \time 1/4 \key d \major
\override NoteHead.color = #color-notehead %<------------ HERE HERE HERE
%------------------------------------------------------------------
\repeat volta 2 { d' d d a8 (b) cis4 d8 (cis) b4 a r16 \bar "" \break
%------------------------------------------------------------------
 d4 cis b a b g fis e d r2 \bar ":|." } \break
%------------------------------------------------------------------
 d4 fis b a gis a r2 d,4 a' a b cis d r2  \bar "" \break
%------------------------------------------------------------------
 cis4 d cis b b a r2 b4 b a b a8 (g) fis4 r  \bar "" \break
<<< Snippit <<<



%{ Coloring notes depending on their pitch It is possible to color note
heads depending on their pitch and/or their names: the function used
in this example even makes it possible to distinguish enharmonics. %}

%Association list of pitches to colors.
#(define color-mapping(list
(cons (ly:make-pitch 0 0 FLAT) (x11-color 'red3))
(cons (ly:make-pitch 0 0 NATURAL) (x11-color 'red3))
(cons (ly:make-pitch 0 0 SHARP) (x11-color 'red3))

(cons (ly:make-pitch 0 1 FLAT) (x11-color 'orange3))
(cons (ly:make-pitch 0 1 NATURAL) (x11-color 'orange3))
(cons (ly:make-pitch 0 1 SHARP) (x11-color 'orange3))

(cons (ly:make-pitch 0 2 FLAT) (x11-color 'yellow3))
(cons (ly:make-pitch 0 2 NATURAL) (x11-color 'yellow3))
(cons (ly:make-pitch 0 2 SHARP) (x11-color 'yellow3))

(cons (ly:make-pitch 0 3 FLAT) (x11-color 'green4))
(cons (ly:make-pitch 0 3 NATURAL) (x11-color 'green4))
(cons (ly:make-pitch 0 3 SHARP) (x11-color 'green4))

(cons (ly:make-pitch 0 4 FLAT) (x11-color 'lightblue3))
(cons (ly:make-pitch 0 4 NATURAL) (x11-color 'lightblue3))
(cons (ly:make-pitch 0 4 SHARP) (x11-color 'lightblue3))

(cons (ly:make-pitch 0 5 FLAT) (x11-color 'darkblue))
(cons (ly:make-pitch 0 5 NATURAL) (x11-color 'darkblue))
(cons (ly:make-pitch 0 5 SHARP) (x11-color 'darkblue))

(cons (ly:make-pitch 0 6 FLAT) (x11-color 'VioletRed4))
(cons (ly:make-pitch 0 6 NATURAL) (x11-color 'VioletRed4))
(cons (ly:make-pitch 0 6 SHARP) (x11-color 'VioletRed4))))

%Compare pitch and alteration (not octave).
#(define (pitch-equals? p1 p2)(and
(= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
(= (ly:pitch-notename p1) (ly:pitch-notename p2))))

#(define (pitch-to-color pitch)
(let ((color (assoc pitch color-mapping pitch-equals?)))(if color(cdr color))))

#(define (color-notehead grob)(pitch-to-color(ly:event-property (event-cause grob) 'pitch)))

<<<<<<<

If someone could maybe explain the last par for me from #(define that would be neat, I am still uncertain what it really does and I am not a programmer, at least only a Newbie, coding has never been my thing - but efforts and time does make something :)

I have a lots of ideas, I will sort it out - and overtime hopefully make things easier for learning Notes and music - Lots of ideas, overburdened brain. First I think the Color noting will be something to dig into, now it works, but I wanna further tune it. You use the Colors to know the Note, which can be very helpful for people like me! :)

Further I have seen notes with the letter inside the circle thing, I can see this app can do numbers as well in it - is there a way that one can have the letters, C D E F G A B and so forth? :) Thanks.

Dearly Regards Darkijah - https://JesusIsGodAlmighty.Life *My Homepage*

Attachment: 185305829_10159630047158754_1283782376917169039_n.jpg
Description: JPEG image


reply via email to

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