lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can NoteNames in higher octaves be changed?


From: David Nalesnik
Subject: Re: Can NoteNames in higher octaves be changed?
Date: Mon, 15 Sep 2014 19:24:13 -0500



On Mon, Sep 15, 2014 at 6:55 PM, David Nalesnik <address@hidden> wrote:
Hi Jay,

On Mon, Sep 15, 2014 at 4:27 AM, Jay Vara <address@hidden> wrote:
> I'm not top posting.

NoteNames will print the higher (and lower) octave names with
printOctaveNames set to true. It prints them as c', d', c, d, etc.

My question is: Is it possible to have the higher octaves print using a
different character, say C D E F etc rather than c', d', e', f'.


Yes, it is possible to do this by modifying the stencil of the NoteName grob.  I'm not sure what your system is, so I thought I'd show how you might convert Lilypond's pitch representation into the familiar C4=middle C system.  You could probably adapt it to your needs.

This only works with single notes at the moment, but I'll fiddle around with it some more.


Well, this looks a lot better.

But you'll notice that it ignores the other two notes in the initial chord.  I wonder if this needs a Scheme engraver...

 \version "2.18.2"

pitches = \relative c,, {
  \clef bass
  <c e g> c' c' c'
  \clef treble
  c' c' c' c'
}

\new Staff {
  <<
    \pitches
    \context NoteNames {
      \set printOctaveNames = ##t 
      \override NoteName.stencil =
      #(lambda (grob)
         (let* ((cause (event-cause grob))
                (pitch (ly:prob-property cause 'pitch))
                (oct (ly:pitch-octave pitch))
                (name (note-name->markup pitch #f))
                (num (+ 4 oct))
                (num-text (number->string num))
                (full-name (make-concat-markup (list name num-text))))
           (grob-interpret-markup grob full-name)))
      \pitches
    }
  >>
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]