1

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"
{
\easyHeadsOn


\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 {
  \easyHeadsOn
  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,, {
  \easyHeadsOn
  \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

Vinod
  • 413
  • 2
  • 5
  • 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*. – Elements in Space May 15 '21 at 08:16
  • @ElementsinSpace, I have found an answer based on the Apos reply below. – Vinod May 15 '21 at 10:13

1 Answers1

3

Here is a sort of hackish way of doing it:

\version "2.20.1"

#(define easyNamedHeads
  (make-engraver
    (acknowledgers
    ((note-head-interface engraver grob source-engraver)
      (let* (
      (grob-pitch
        (ly:event-property (event-cause grob) 'pitch))
      (grob-name (ly:pitch-notename grob-pitch))
      (octave-name (ly:pitch-octave grob-pitch))
      (note-names
        (make-vector
          7
          (string-append
            (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 {
    \Voice
    \consists \easyNamedHeads
  }
}

\relative c' {
  \easyHeadsOn
  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

Apos
  • 48
  • 4
  • 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 '21 at 07: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 '21 at 19:23
  • nvm, I see that you wanted those specific notes that you wrote to cover multiple octaves. – Apos May 15 '21 at 23:06