lilypond-user
[Top][All Lists]
Advanced

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

Re: printing the current moment in a context


From: David Kastrup
Subject: Re: printing the current moment in a context
Date: Wed, 16 Aug 2017 11:47:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Kieren MacMillan <address@hidden> 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 "address@hidden" (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

reply via email to

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