Time mark engraver: Difference between revisions

Make the snippet display its result
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 9: Line 9:
* find “time since start” at a few musical key positions without counting or math, or
* find “time since start” at a few musical key positions without counting or math, or
* work reliably across complex tempo maps (rit., accel., metric modulations, etc.).
* work reliably across complex tempo maps (rit., accel., metric modulations, etc.).
''Upgrade notice'': This snippet must be updated with the {{Convert-ly-devel}} script if used with a LilyPond version newer than 2.24.


<lilypond version="2.24">
<lilypond version="2.24">
Line 15: Line 17:


#(define (Elapsed_time_engraver context)
#(define (Elapsed_time_engraver context)
   (define (format-time seconds) ;; example: 2m15s
   (define (format-time seconds) ; example: 2m15s
     (let ((minutes (euclidean-quotient seconds 60))
     (let ((minutes (euclidean-quotient seconds 60))
           (rest (euclidean-remainder seconds 60)))
           (rest (euclidean-remainder seconds 60)))