I need the note heads to be printed in notes with octave.

The below code in lilypond prints C, D, E, F, G, A, B in notehead:

\version "2.20.1"

\clef treble
  <c d e f g a b>

How can I have C3, D3, E3, F3, G3, A3, B3 in notehead?

How to continuously print C2, D2, E2, F2, G2, A2, B2,C3, D3, E3, F3, G3, A3, B3,C4, D4, E4, F4, G4, A4, B4,C5, D5, E5, F5, G5, A5, B5,C6, D6, E6, F6, G6, A6, B6 with lilypond?

I found an answer below:

\relative c {
  c d e f g a b c d e f g a b c d e f g a b c d e f g a b


\relative c,, {
  \clef bass
  c d e f g a b c d e f g a b c d e f g a b c d e f g a b 


enter image description here

  • I don't understand your edit at all. The excellent answer below provides you with a code that adds the octave numbers to easyheads for any notes you want. May 15, 2021 at 8:16
  • @ElementsinSpace, I have found an answer based on the Apos reply below.
    – Vinod
    May 15, 2021 at 10:13

1 Answer 1


Here is a sort of hackish way of doing it:

\version "2.20.1"

#(define easyNamedHeads
    ((note-head-interface engraver grob source-engraver)
      (let* (
        (ly:event-property (event-cause grob) 'pitch))
      (grob-name (ly:pitch-notename grob-pitch))
      (octave-name (ly:pitch-octave grob-pitch))
            (string (integer->char (+ 65 (modulo (+ 2 grob-name) 7))))
            (number->string (+ 4 octave-name))))))
  (ly:grob-set-property! grob 'note-names note-names))))))

#(set-global-staff-size 26)

\layout {
  ragged-right = ##t
  \context {
    \consists \easyNamedHeads

\relative c' {
  c4 d e f
  g4 a b c \break

  \key a \major
  a,4 b cis d
  e4 fis gis a \break

  \key d \dorian
  d,4 e f g
  a4 b c d

I mostly edited this example: https://lilypond.org/doc/v2.23/Documentation/notation/note-heads#easy-notation-note-heads.

I say hackish because I'm sure there's a better way to convert the octave-name into the right letters (A, B, C, D, etc) but for now I convert the number using ascii char codes.

enter image description here

  • Good hack. How to continue. I have asked for 'C3, D3, E3, F3, G3, A3, B3' actually. How to continuously print C3, D3, E3, F3, G3, A3, B3C4, D4, E4, F4, G4, A4, B4,C5, D5, E5, F5, G5, A5, B5 with lilypond. I have edited the qn.
    – Vinod
    May 15, 2021 at 7:17
  • I don't understand what you mean by that. How are those notes different? How does my answer not work for your case?
    – Apos
    May 15, 2021 at 19:23
  • nvm, I see that you wanted those specific notes that you wrote to cover multiple octaves.
    – Apos
    May 15, 2021 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.