lilypond-user
[Top][All Lists]
Advanced

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

Re: Programming Question


From: Jay Vara
Subject: Re: Programming Question
Date: Thu, 18 Sep 2014 15:54:20 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

>I am not top-posting

David,

You are way too good!

Is this the way I enter it? For some reason, does not seem to be working 
- it seems to be ignoring the suffix.

If I wanted to display new-name as the program runs, is there a command 
for that?

Thanks
Jay

\version "2.18.2"

music =  \relative c' {c2 d e f g a b c c b a g f e d c}
  
  
newnames =
#`(("c" . "S")
   ("d" . "R")
   ("e" . "G")
   ("f" . "M")
   ("g" . "P")
   ("a" . "D")
   ("b" . "N")
   )
  


#(define (myNoteNames size)
(lambda (grob)
   (let* (
          ;; bindings
          (default-name (ly:grob-property grob 'text))
          (new-name (assoc-get default-name newnames))
          (cause (event-cause grob))
           (duration (ly:prob-property cause 'duration))
           (duration-log (ly:duration-log duration))
           (suffix
            (case duration-log
              ((1) "a") ;; half note
              (else "")))
           (text (string-append new-name suffix))
         )  
          ;; body
         (ly:grob-set-property! grob 'text (markup #:fontsize size new-
name))
         (ly:text-interface::print grob)
         
         )
   ))

\new Staff {
  <<
     \new Voice {
       \music 
     \shiftDurations #1 #0 {\music } 
     \shiftDurations #2 #0 {\music \music }
     }
    \context NoteNames {
      
      \override NoteName.stencil = #(myNoteNames 0)
        \music 
        
       \override NoteName.stencil = #(myNoteNames -1)
        \shiftDurations #1 #0 {\music } 
        
        \override NoteName.stencil = #(myNoteNames -2)
        \shiftDurations #2 #0 {\music \music }
        
    }
  >>
}





reply via email to

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