lilypond-user
[Top][All Lists]
Advanced

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

Re: calculation of the total duration of a score


From: David Kastrup
Subject: Re: calculation of the total duration of a score
Date: Sun, 11 Sep 2016 12:16:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Marc Hohl <address@hidden> writes:

> Hi Harm, hi Paul,
>
> thanks a lot for your code/improvements/discussion to this subject!
>
> Definitively worth to be put in the LSR!
>
> Some remarks from me as a real-life user:
>
> the engraver does not expand repeats, so if there ist some \repeat
> volta ... construct around, the total duration is not only wrong
> (which is clear from the way the engraver works) but somewhat strange.
>
> So my humble question to the scheme wizards out there: is it possible
> to store the total duration in a variable/property to be read
> afterwards?
>
> I think of something like
>
> music = { ... }
>
> \score {
>    \new Staff {
>       \music
>       \mark \markup "Duration:
>             #(get-total-duration #{ \unfoldRepeats \music #})"
>       \bar "|."
>    }
> }
>
> (just pseudo-code, of course)
>
> Would this be somehow possible?

I probably lack the imagination for seeing your problem.

music =
\fixed c'
{ c1 \repeat volta 4 { g1 } \alternative { { c1 g1 } { r1 } } }

\score {
   \new Staff {
      \music
      \mark \markup
      #(format "Duration: ~a"
        (ly:moment-main (ly:music-length #{ \unfoldRepeats \music #})))
      \bar "|."
   }
}

-- 
David Kastrup

reply via email to

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