Note names

Note names can be printed as text, by using the NoteNames context. When used simultaneously with a regular staff, that makes it possible to synchronize each note with its name, printed above or below the Staff.

\language "italiano"
melody = \relative do'' {
  fad2 si,8 dod re mi fad4. re8 fad2
}

<<
  \new NoteNames { \melody }
  \new Staff { \key si \minor \melody }
  \new NoteNames {
    \set printNotesLanguage = "deutsch"
    \set printAccidentalNames = ##f
    \melody
  }
>>

[image of music]

By default, note names are printed in the same language used for music entry; however, the printNotesLanguage property allows to select any other language available (see Note names in other languages). Whether accidentals should be printed or not is determined through the printAccidentalNames property.

By setting both that property to a symbol and printOctaveNames to #t, note names can be obtained that closely resemble LilyPond entry syntax. If a more general result is desired, ‘scientific’ octave names may also be obtained.

melody = \relative c'' {
  fis2 b,8 cis d e fis4. d8 fis2
}

<<
  \new NoteNames {
    \set printOctaveNames = ##t
    \set printAccidentalNames = #'lily
    \melody
  }
  \new Staff { \key b \minor \melody }
  \new NoteNames {
    \set printOctaveNames = #'scientific
    \melody
  }
>>

[image of music]

The noteNameSeparator property defines how chords will be printed. Other formatting functions may be defined as noteNameFunction; such a function must expect a pitch and a context argument, even if one of these can then be ignored.

somechords = \relative c' {
  <b d fis>2 <b cis e g> <b d fis> q
}

<<
  \new NoteNames {
    \set noteNameSeparator = "+"
    \somechords
  }
  \new Staff { \key b \minor \somechords }
  \new NoteNames {
    \set noteNameFunction =
      #(lambda (pitch ctx)
         (alteration->text-accidental-markup
          (ly:pitch-alteration pitch)))
    \somechords
  }
>>

[image of music]

See also

Notation Reference: Note names in other languages.

Internals Reference: NoteName, NoteNames, Note_name_engraver.


LilyPond Notation Reference v2.25.21 (development-branch).