color every note-head by its note-name

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

color every note-head by its note-name

Kenneth Lee

Hi,

i would like to color the note-head by its note-name
on the whole score. For example, to color every C with
red and every D with yellow, for example.

i have tried \applyoutput but it only work on the note
that follows immediately. This means i need to
\applyoutput on every notes which is not perferrable.

any help would be deeply appreciated.

Many thanks.
ken lee



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: color every note-head by its note-name

Han-Wen Nienhuys
Kenneth Lee wrote:

> Hi,
>
> i would like to color the note-head by its note-name
> on the whole score. For example, to color every C with
> red and every D with yellow, for example.
>
> i have tried \applyoutput but it only work on the note
> that follows immediately. This means i need to
> \applyoutput on every notes which is not perferrable.
>
> any help would be deeply appreciated.

try examining the 'pitch property of the NoteHead 'cause property  from
within the 'print-functon callback.

--
  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: color every note-head by its note-name

David Raleigh Arnold-2
In reply to this post by Kenneth Lee
Kenneth Lee wrote:
> Hi,
>
> i would like to color the note-head by its note-name
> on the whole score. For example, to color every C with
> red and every D with yellow, for example.

You could write an editing filter with sed that would
do that and that way you could avoid typing backslashes.
It's just simple substitution, after all.  It's similar
to inserting harmonica or whistle tab as markup or
fingering.

There may be a way within lilypond now, too.  daveA



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: color every note-head by its note-name

Erik Sandberg
In reply to this post by Kenneth Lee
On Friday 19 August 2005 17.50, Kenneth Lee wrote:

> Hi,
>
> i would like to color the note-head by its note-name
> on the whole score. For example, to color every C with
> red and every D with yellow, for example.
>
> i have tried \applyoutput but it only work on the note
> that follows immediately. This means i need to
> \applyoutput on every notes which is not perferrable.
>
> any help would be deeply appreciated.

You could take a look at \musicMap. It could be used to
map each NoteEvent cis8 to { \applyoutput {...} cis8 }

It requires some Scheme hacking though, and you need to know about the
internal representation of Music Expressions. It's probably doable in less
than 20 lines of code, including colour codes.

--
Erik


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
stk
Reply | Threaded
Open this post in threaded view
|

Re: color every note-head by its note-name

stk
In reply to this post by Kenneth Lee
Erik Sandberg wrote:

> It requires some Scheme hacking though, and you need to know about the
> internal representation of Music Expressions. It's probably doable in
> less than 20 lines of code, including colour codes.

Where does there exist a systematic explanation of the details of
-- LilyPond's internal representations in general
-- all of the Scheme functions used in LilyPond

I admit I shouldn't be asking this question yet, as at this point I have
worked my way through only about a quarter of one of the online Scheme
tutorials. Years ago I did some programming in Lisp 1.5; it isn't the kind
of thing you forget.  Looking at *.SCM files and seeing function
definitions with parameters that aren't even used in the body of the
function (parser, location,...)  made me realize I had to learn Scheme.
But I have a suspicion that learning Scheme isn't going to get me very far
without an explanatory reference on the data structures and functions
peculiar to LilyPond.

Searching for stuff in the Program Reference manual by itself doesn't
suffice.  I can find possibly relevant terms that way, but if I can't find
a usage example in one of the *.SCM files in the distribution, LOL.

Or is it just felt that it would be better if new users weren't distracted
by trying to acquire a knowledge of the details of LilyPond Scheme?

-- Tom



_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: color every note-head by its note-name

Erik Sandberg
On Tuesday 23 August 2005 07.42, [hidden email] wrote:
> Erik Sandberg wrote:
> > It requires some Scheme hacking though, and you need to know about the
> > internal representation of Music Expressions. It's probably doable in
> > less than 20 lines of code, including colour codes.
>
> Where does there exist a systematic explanation of the details of
> -- LilyPond's internal representations in general

There is no public general document on this matter.

I wrote a rough overview of the structure in my thesis, which can be acquired
by CVS:
export CVSROOT=:pserver:[hidden email]:2401/exjobb2005-1
cvs co exjobb

It's currently terribly broken, so only look there if you're in a desperate
need for it, and only look at the first 2-3 chapters. Please don't expect
anything from the document.

> -- all of the Scheme functions used in LilyPond

See lilypond internals,
http://lilypond.org/doc/v2.7/Documentation/user/out-www/lilypond-internals/Scheme-functions.html#Scheme-functions

> I admit I shouldn't be asking this question yet, as at this point I have
> worked my way through only about a quarter of one of the online Scheme
> tutorials. Years ago I did some programming in Lisp 1.5; it isn't the kind
> of thing you forget.  Looking at *.SCM files and seeing function
> definitions with parameters that aren't even used in the body of the
> function (parser, location,...)  made me realize I had to learn Scheme.
No, that's just a convention used in Lily. Those parameters are used only for
error reporting.
> But I have a suspicion that learning Scheme isn't going to get me very far
> without an explanatory reference on the data structures and functions
> peculiar to LilyPond.

This is a problem. You're very welcome to help us with it.

I think a good start can be to play around with displayLilyMusic, FWIW.

> Searching for stuff in the Program Reference manual by itself doesn't
> suffice.  I can find possibly relevant terms that way, but if I can't find
> a usage example in one of the *.SCM files in the distribution, LOL.
>
> Or is it just felt that it would be better if new users weren't distracted
> by trying to acquire a knowledge of the details of LilyPond Scheme?
'lilypond Scheme' is actually GNU Guile plus the functions on the link above.

--
Erik


_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user