lilypond-user
[Top][All Lists]
Advanced

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

Re: Multiple context NoteNames


From: Aaron Hill
Subject: Re: Multiple context NoteNames
Date: Tue, 17 Sep 2019 05:52:13 -0700
User-agent: Roundcube Webmail/1.3.8

On 2019-09-17 3:20 am, Jay Vara wrote:
Now, some of the student also want to see the names of notes C, D, E, F, G,
A, B.

Is there a way to show both the note names I have defined and the english
note names? Ideally, one would be below the other.

Simplest option is to just define another NoteNames context that omits changing the stencil. Then you can control each as you want.

Of course, you can always define any arbitrary markup if you want when changing the text property. An example of what you can do is below:

%%%%
\version "2.19.83"

newnames =
#`(("c" . "S")
   ("d" . "R")
   ("e" . "G")
   ("f" . "M")
   ("g" . "P")
   ("a" . "D")
   ("b" . "N"))

myNoteNames =
#(lambda (grob)
   (let* ((default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name newnames)))
         (ly:grob-set-property! grob 'text new-name)
   (ly:text-interface::print grob)))

myNoteNamesWithOld =
#(lambda (grob)
   (let* ((default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name newnames)))
         (ly:grob-set-property! grob 'text #{ \markup
           \override #'(baseline-skip . 1.5)
           \center-column {
             \line { \bold $new-name }
             \line { \tiny \concat { ( $default-name ) } } } #})
   (ly:text-interface::print grob)))

geetam = \relative c' { e4 e g2 g a4 g c2 c }

\new Staff
<<
  \geetam
  \new NoteNames \with {
    \override NoteName #'stencil = #myNoteNames
    \override NoteName #'color = #red
  } { \geetam}
  \new NoteNames \with {
    \override NoteName #'color = #green
  } { \geetam}
  \new NoteNames \with {
    \override NoteName #'stencil = #myNoteNamesWithOld
    \override NoteName #'color = #blue
  } { \geetam} >>
%%%%


-- Aaron Hill

Attachment: notenames.cropped.png
Description: PNG image


reply via email to

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