I have a program which is roughly as below:

\score {
   \new staff
     {
        \key c \major
        <<
            \new voice
               {
                  musicA
               }
            \context NoteNames
               {
                 \override NoteName.stencil = #myNoteNames
                 musicA

               }

       }
      \layout{}
}

\score {
   \new staff
     {
        \key g \major
        <<
            \new voice
               {
                  musicB
               }
            \context NoteNames
               {
                 \override NoteName.stencil = #myNoteNames
                 musicB

               }

       }
      \layout{}
}

Two rougly identical blocks, the only difference being the key and music.

It appears to me that by the time the NoteNames of musicA prints, the key
signature has already changed to G major. I introduced another copy of \key
c \major inside the NoteNames context - but still I can see that in
#myNoteNames function that the key signature has changed.

Is there a way to force NoteNames to print using the key signature defined
in its context?

The workaround I have is to have each score in a separate .ly file. Not
such a good solution since I have many scores in the file.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to