lilypond-user
[Top][All Lists]
Advanced

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

Engraver Programming Question


From: Jay Vara
Subject: Engraver Programming Question
Date: Wed, 24 Sep 2014 18:31:30 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

>I am not top-posting

I tried to build in a way to get the measurePosition and measureLength 
in a user defined engraver (lines 13 and 14). The idea was to change 
them as needed. As a first step, I wanted to print the values - I tried 
putting in a format statement (line 23). 

The program runs without errors, but does not produce any output. What 
seems to be the problem with lines 15, 16 (commented out) and 23?

\version "2.18.2"
measure-len = 1
measure-pos = 1
note-names = "Sa"
#(define SolfegeEngraver
   (list
    (cons 'acknowledgers
      (list
       (cons 'note-head-interface
         (lambda (engraver grob source-engraver)
           (let* ((context (ly:translator-context engraver))
                  (tonic-pitch (ly:context-property context 'tonic))
                  (measure-pos (ly:context-property context 
'measurePosition))
                  (measure-len (ly:context-property context 
'measureLength))
                  ; (measure-pos 0)
                  ; (ly:context-set-property! context 'measurePosition 
measure-pos)
                  (tonic-name (ly:pitch-notename tonic-pitch))
                  (delta (- 7 tonic-name))

                  (solfege-base (circular-list "S" "R" "G" "M" "P" "D" 
"N"))
                  (solfege (take (drop solfege-base delta) 7))
                  (note-names (apply vector solfege)))
             (format "length ~a position ~a note-names ~a ~%" measure-
len measure-pos note-names)
             ; (display solfege)(newline)
             (ly:grob-set-property! grob 'note-names
               note-names))


           )))))

   )

\score {
  \new Staff
  {

    \new Voice  
    {
      \easyHeadsOn
      \relative c' { c d e f g a b c }

    }


  }
  \layout {
    \context {
      \Voice
      \consists \SolfegeEngraver

    }
  }
}





reply via email to

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