lilypond-user
[Top][All Lists]
Advanced

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

Color script for Note Colors, Code and instructions for trying it out an


From: darkijah
Subject: Color script for Note Colors, Code and instructions for trying it out and note letters for help for beginners - and if anyone could explain some code for me as well.
Date: Fri, 14 May 2021 07:47:18 +0200
User-agent: Gigahost Webmail

Okay guys I made this color script for now, put in a ly file and name it \include "ScriptColor.ly" put in the folder with the rest of your ly and \include "ScriptColor.ly" in your notesheet. then put \override NoteHead.color = #color-notehead in inside your notes box... The idea is to easily be able to add colors to a notesheet. You can further add \easyHeadsOn into it as well for letters for each note, but I am still working on how to size the notes correctly and looking it it. I will try to improve things as we go, as I learn and improve the things. These Colors are made for easier understanding for newbies, starting with the lowest Vibration to the Highest Red to violet. C - red, D - orange, E - yellow, F - Green, G - Lightblue, A - Blue, B - Violet. I don't know if I can write any help file into the #(define color mappaing, it seems it won't acccept me putting % inside of it for explaining things, anyone knows if it is possible? Or if I need to put it outside for explaining things. Now undestanding the colors, somewhat and getting the result I wanted, if anyone could explain to me the last part of the script for further improvement maybe, that would be nice. It is very small, but I am not a hardcore coder, I am not born as a coder in any way. I need to further adjust colors at some point, to find the best, and see what else can be done that I would like to see - if it is possible or not and what needs to be done to get there.

So here is the Script, the idea as I told you was to use the include so one can easily try it out on any Sheet and see the effect. :) I think it is pretty cool overall. I'm looking into making some sheets with as much help for the Newbie as possible so they can easily learn the Tin Whistle and play songs and enjoy and having fun learning while actually playing something. I know it can be so much easier then what I had to go through in regards of learning. Anyway, the Script:

#(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)))

% Script end ------------------------------------------------------------------------------ Save it as ScriptColor.ly or whatever name you want and put in the folder with the other ly sheets and save the file. Include it at the top of the sheep, \include "ScriptColor.ly" right after the Version number I usually put, like after four days of use of lilypond it seems to be a good place to put it. put \override NoteHead.color = #color-notehead into the note section and if you want letters on your notes \easyheadsOn like this:
\score {
  <<
    \new Staff {
      \new Voice = "sang" {
\relative d' { \easyHeadsOn %<- HERE IF YOU WANT LETTERS ON YOUR NOTES
  \time 1/4 \key d \major
\override NoteHead.color = #color-notehead %<-HERE IT IS INSERTED BY ME-
%------------------------------------------------------------------
\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

%----- End of Example ----------------------

Enjoy :)

I am looking into the size of the notes in regards of \easyheadsOn but on some different levels I am pretty blank where that feature is they are talking about on the page, I have made another post on that, I am still pretty new to Lilypond so I need to get more comfortable with the Application and the coding and all that. I think I will go through all the Tutorial videos again and see if I can pick some more stuff up. Sadly the guy on youtube stopped making them, would have loved to see more.

Ohh, I hear that it is the Day of Rest... hmm interesting, Last day for the blessed and last day of the week, starting at sunset. It is friday morning today, I can hear the cleaner of the stairs he comes at friday, he is early unto it, it seems. Then the Cheese Wagon is also coming just over the street, nice with those signs to keep me remembering the day :P Anyway... I just wanted to try out Lilypond, to see if I could do what I wanted - but I must say, this seems to be more then a test, I am pretty convinced this can throw away my other Note app out the window when I just get everything up and running.

On a side note - it seemed that the page with all the Lilypond examples, don't recall the web address at the moment had a lot of the same examples multiple times? Like it seemed going through it that the same things came up here and there. But maybe there is a version difference and what not... Anyway, awesome Application, using it with Frescobaldi. I tried that other popular application, MuseScore but finding me trapped in Measure boxes I threw it out. I am now using Maestro on my mobile as default, or was at least :P Where I don't need to think of any boxes as all. I HATE MEASURE BOXES, just get rid of them - love the simpleness of the 1600 notations, seems much more sane to me. By the People for the People to the Children. So many nice helping things, that has just today been thrown out the window! And I hate complex music, like everybody want a big mess of insanity mixed together ruining everything. but anyway, that is another topic altogether. Simpleness in Music is apparently very hard to accomplished for many writers. Satan really knows how to ruin good music to say the least, lots of music insanity is found in the churches making it impossible to listen to the Lyrics.

Dearly regards
- Darkijah

Attachment: 186118689_10159632674763754_705611723270261528_n.jpg
Description: JPEG image


reply via email to

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