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
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to