Kieren MacMillan <kieren_macmil...@sympatico.ca> writes:

> Hi all,
>
> Is there a function (2.19.64) that will output the current context
> moment (e.g., measure number and beat) as markup?
> In my polymetric scores, I need to target moments (using the
> edition-engraver), and it currently involves a bit too much
> trial-and-error…

Something like

#(define (moment->string mom)
  (if (zero? (ly:moment-grace mom))
   (number->string (ly:moment-main mom))
   (format "~sG~a" (ly:moment-main mom) (ly:moment-grace mom))))

currentmom =
-\tweak text
#(lambda (grob)
   (let* ((loc (grob::rhythmic-location grob)))
     (if (pair? loc)
	 #{ \markup \with-color #red #(format "~a@~a" (car loc)
					      (moment->string (cdr loc))) #}
         "")))
-""

{ c d\currentmom f g }
I would have used rhythmic-location->string but it relies on
ly:moment->string that never ever was defined over the history of
LilyPond.  Cough cough.

-- 
David Kastrup
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to