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: Tue, 16 Sep 2014 08:10:40 -0500

Hi Jay,

On Tue, Sep 16, 2014 at 6:52 AM, Jay Vara <address@hidden> wrote:
> I'm not top posting.

David,

How I wish I could understand how you do what you do! It all looks like
magic to me. Is there a place that shows how to use all these functions?

There is a list of Scheme functions (http://lilypond.org/doc/v2.18/Documentation/notation/scheme-functions), the Extending manual, and of course the Internals Reference.  But there are a lot of functions which you can only know about by looking through the code base.  scm/lily-library.scm has a number of useful Scheme functions, for example.

As far as GUILE, I've gotten a lot from the 1.8 documentation (http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/index.html).  Unfortunately, the LilyPond specific stuff is a bit harder to discover!  (And the documentation is certainly no tutorial, as you'll see from the list of Scheme functions.)

Since you're new to the program, I hope you're not getting the impression that it's impossibly arcane.  Well, it can be, but for the vast amount of typical usage, LilyPond is straightforward to use and admirably documented.

Questions like yours are great because they show areas where the program might be improved.  Easy change of NoteName pitches (whether it be for a custom system, or "scientific" pitch notation--C4 and the like) would be a useful addition, I think.



I tried to adapt what you showed to my system. So far, all attempts have
resulted in syntax error or other error, mostly because I do not know
what the commands actually do.

Here is what I have - it prints the NoteNames as S R G M P D and N as
defined in the newnames variable. For the range of notes from low G to
high G, it prints P D N S R G M P D N S R G M P. What I would like to
see printed is: p  d  n  S  R  G  M  P  D  N  s̊  r̊  g̊  m̊  p̊ [where the
higher octave notes have a dot on top].

Jay

\version "2.18.2"

music =  {g2 a b c d e f g a b c d e f g}


newnames =
#`(("c" . "S")
   ("d" . "R")
   ("e" . "G")
   ("f" . "M")
   ("g" . "P")
   ("a" . "D")
   ("b" . "N"))


myNoteNames =
#(lambda (grob)
   (let* (
          ;; bindings
          (default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name newnames))
         )
          ;; body
         (ly:grob-set-property! grob 'text new-name)
         (ly:text-interface::print grob)
         )
   )


\new Staff {
  <<
    \relative c' \music
    \context NoteNames {
      \set printOctaveNames = ##t
      \override NoteName.stencil = #myNoteNames

Oh, such a simple and easy-to-miss problem!  (It took me a while.)  You need another \relative c' before \music.  (You could attach it to your variable above, so you aren't liable to forget.)
 
        \music
    }
  >>
}


All you'd have to do to make your function work is add the note-names-with-octaves to your newnames alist.  If you're just dealing with the limited range in your example, a simple extension seems reasonable.

Hope this helps!

David


reply via email to

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