[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: Highlight specific pitch(es)
From: Stephan_Schöll <music () gmx ! ch>
Date: 2023-07-28 15:59:53
Message-ID: 67e7d6ba-860c-14ea-8840-53a58de696e4 () gmx ! ch
[Download RAW message or body]
Perfectly what I've been looking for. Thanks a lot for the code as well
as for the hint to the callback explanation, Jean!
Am 28.07.2023 um 17:43 schrieb Jean Abou Samra:
>
> Le vendredi 28 juillet 2023 à 16:46 +0200, Stephan Schöll a écrit :
>
>> Hi all
>>
>> In order to ease pitch orientation for novice score readers I'd like
>> to highlight the fundamental / key note (tonika) and perhaps the 5th
>> throughout an entire piece. The most obvious marking might be by
>> coloring the note head (and stem).
>>
>> In the following MVE I'd like to highlight alle the c's and g's:
>>
>> \relative c' { c4 d e c e f g2 }
>>
> That's a good job for a simple callback.
>
> |\version "2.24.1" \layout { \context { \Score \override
> NoteHead.color = #(lambda (grob) (let* ((pitch (ly:event-property
> (event-cause grob) 'pitch)) (semi (modulo (ly:pitch-semitones pitch)
> 12))) (cond ((eqv? semi 0) "red") ((eqv? semi 7) "blue") (else
> "black")))) } } \relative c' { c d e f g f e d c b a g fis g a b c1 } |
>
> There is a very similar example on
> https://extending-lilypond.gitlab.io/fr/extending/backend.html#understanding-callbacks
>
> HTH,
>
> Jean
>
[Attachment #3 (text/html)]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Perfectly what I've been looking for. Thanks a lot for the code
as well as for the hint to the callback explanation, Jean!<br>
</p>
<div class="moz-cite-prefix">Am 28.07.2023 um 17:43 schrieb Jean
Abou Samra:<br>
</div>
<blockquote type="cite"
cite="mid:37d98f59d567fff3822be2bf914d92ace410bd0d.camel@abou-samra.fr">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>Le vendredi 28 juillet 2023 à 16:46 +0200, Stephan Schöll a
écrit :</p>
<blockquote type="cite">
<p>Hi all</p>
<p>In order to ease pitch orientation for novice score readers
I'd like to
highlight the fundamental / key note (tonika) and perhaps the
5th
throughout an entire piece. The most obvious marking might be
by
coloring the note head (and stem).</p>
<p>In the following MVE I'd like to highlight alle the c's and
g's:</p>
<p>\relative c' {
c4 d e c
e f g2
}</p>
</blockquote>
<p>That's a good job for a simple callback.</p>
<pre><code>\version "2.24.1"
\layout {
\context {
\Score
\override NoteHead.color =
#(lambda (grob)
(let* ((pitch (ly:event-property (event-cause grob) 'pitch))
(semi (modulo (ly:pitch-semitones pitch) 12)))
(cond ((eqv? semi 0)
"red")
((eqv? semi 7)
"blue")
(else "black"))))
}
}
\relative c' { c d e f g f e d c b a g fis g a b c1 }
</code></pre>
<p>There is a very similar example on
<a class="moz-txt-link-freetext" \
href="https://extending-lilypond.gitlab.io/fr/extending/backend.html#understanding-cal \
lbacks">https://extending-lilypond.gitlab.io/fr/extending/backend.html#understanding-callbacks</a></p>
<p>HTH,</p>
<p>Jean</p>
</blockquote>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic