Re: [frogs] Re: Numeric note heads for singers

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]



>----Original Message----
>From: pounderd@xxxxxxxxxxx
>Date: 10/01/2010 19:46 
>To: <n.puttock@xxxxxxxxx>
>Cc: "Ian Hulin"<ian@xxxxxxxxxxxx>, "lilypond-user@xxxxxxx"<lilypond-
user@xxxxxxx>, "frogs@xxxxxxxxxxx"<frogs@xxxxxxxxxxx>, <c_sorensen@byu.
edu>
>Subj: Re: [frogs] Re: Numeric note heads for singers
>
>
>
>>----Original Message----
>>From: n.puttock@xxxxxxxxx
>>Date: 10/01/2010 19:16 
>>To: "pounderd@xxxxxxxxxxx"<pounderd@xxxxxxxxxxx>
>>Cc: "Ian Hulin"<ian@xxxxxxxxxxxx>, "frogs@xxxxxxxxxxx"
<frogs@lilynet.
>net>, "lilypond-user@xxxxxxx"<lilypond-user@xxxxxxx>, 
<c_sorensen@byu.
>edu>
>>Subj: Re: [frogs] Re: Numeric note heads for singers
>>
>>2010/1/10 pounderd@xxxxxxxxxxx <pounderd@xxxxxxxxxxx>:
>>
>>> Could you try running the lily source below which I think 
provides 
>a
>>> simple means to the same end and could be turned into a snippet? 
If 
>you
>>> then still think it would be useful to have this automated, I'll
>>> continue where I left off.
>>
>>If you want to automate this, it can now be easily done without
>>touching the C++ code, since Han-Wen's just added basic support for
>>scheme-programmable engravers.  It's a good candidate for a
>>documentation snippet, since it would be a gentle introduction to
>>rolling one's own engravers in scheme.
>>
>>Regards,
>>Neil
>>
>>
>
>I think this makes a lot of sense. Thanks for the feedback.
>
>- David.

Actually, the new scheme engraver functionality is so good that the 
code below seems to do the trick. Unfortunately, it doesn't demonstrate 
very much of what can be done with engravers, but I can turn it into a 
snippet if it would be useful.

- David.

 #(define ez-numbers-engraver (list
  (cons 'acknowledgers
   (list
     (cons 'note-head-interface
       (lambda (engraver grob source-engraver)
         (let* (
           (context (ly:translator-context engraver))
           (tonic (ly:context-property context 'tonic))
           (tonic-index (ly:pitch-notename tonic))
           (grob-pitch (ly:event-property (event-cause grob) 'pitch))
           (grob-index (ly:pitch-notename grob-pitch))
           (delta (modulo (- grob-index tonic-index) 7))
           (note-names
             (map
               (lambda (x)
                 (list->string
                   (list
                     (integer->char
                       (+ 1 delta (char->integer #\0))))))
              '(0 1 2 3 4 5 6))))
        (ly:grob-set-property! grob 'note-names (list->vector note-
names)))))))))


\layout {
  \context {
    \Voice
    \consists \ez-numbers-engraver
  }
}

\relative c' {
  \easyHeadsOn
  c d e f g a b c
  \key a \major
  a, b c d e f g a
  \key b \dorian
  b, c d e f g a b
}



2009: A year in review - http://www.tiscali.co.uk/2009


---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/