音名を表示し、オクターブの表示を制御する

音符の音名を表示するために、NoteNames コンテキストを用いることができます。printOctaveNames プロパティは音符のオクターブを表示するか否かを設定します。

scale = \relative c' {
  a4 b c d
  e4 f g a
}

\new Staff {
  <<
    \scale
    \context NoteNames {
      \set printOctaveNames = ##f
      \scale
    }
  >>
  R1
  <<
    \scale
    \context NoteNames {
      \set printOctaveNames = ##t
      \scale
    }
  >>
}

\layout {
  \context {
    \NoteNames
    % Allow vertical overlapping of different `NoteNames` contexts
    % to make them appear as if they were a single line.
    \override VerticalAxisGroup
              .nonstaff-nonstaff-spacing
              .minimum-distance = ##f
  }
}
[image of music]

LilyPond snippets v2.25.33 (development-branch).