Hi Jay,

to output something, you have to display it. The format function returns the formatted string. If you insert #t (true) prior the format string, it will output the result to stdout:


(format #t "length ~a position ~a note-names ~a ~%" measure-len measure-pos note-names)


HTH
Jan-Peter

Am 24.09.14 20:31, schrieb Jay Vara:
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

     }
   }
}



_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to