Hi Jay,

On Mon, Sep 15, 2014 at 4:27 AM, Jay Vara <y...@diljun.com> 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.

Hope this helps,
David

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \version "2.18.2"

pitches = \relative c,, {
  \clef bass
  c c' c' c'
  \clef treble
  c' c' c' c'
}

#(define (extract-note-name str)
   (let* ((lst (string->list str))
          (hd (take-while char-alphabetic? lst)))
     (list->string hd)))

\new Staff {
  <<
    \pitches
    \context NoteNames {
      \set printOctaveNames = ##t
      \override NoteName.stencil =
      #(lambda (grob)
         (let* ((text (ly:grob-property grob 'text))
                (name (string-upcase (extract-note-name text)))
                (up-count (string-count text #\'))
                (down-count (string-count text #\,))
                (num
                 (cond
                  ((> up-count 0) (+ up-count 3))
                  ((> down-count 0) (- 3 down-count))
                  (else 3)))
                (num-text (number->string num))
                (name (string-append name num-text)))
           (grob-interpret-markup grob name)))
      \pitches
    }
  >>
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to