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: Marc Hohl
Subject: Re: calculation of the total duration of a score
Date: Sun, 11 Sep 2016 10:48:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

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?

Thanks,

Marc




Am 10.09.2016 um 20:48 schrieb Thomas Morley:
Hi Paul,

many thanks for looking into it and adding a diff, much easier to
compare the versions. :)

2016-09-10 20:08 GMT+02:00 Paul <address@hidden>:
On 09/09/2016 05:27 PM, Thomas Morley wrote:

Attached you'll find a different version.


I noticed that text-only tempos (\tempo "Andante") caused problems. See
attached revision which fixes this.

Good catch, I overlooked this.
Also for the insufficient
  (if duration-marks
which was kept from an earlier version. Ofcourse your correction is
the way to go.

It also has improved code for detecting
a missing initial tempo (to then supply the default one).  See attached diff
file for changes.

You asked:
2016-09-10 16:40 GMT+02:00 Paul <address@hidden>:

Also, I wonder, where you clear out these variables at the end of the
finalize stage:

         (set! evts '())
         (set! last-evt #f)
         (set! tempo-change-evts '())
         (set! duration-marks '())

Of course, it doesn't hurt, but is it necessary?  If so I need to do that in
my code.

Well, at first it's a matter of code-hygiene. Those variables were
filled by the engraver doing it's work, why not clear them?
Additional I fear bleeding over, if the same engraver is used while
compiling multiple scores/files. Or if he is put into multiple
contexts of the same score.
Not entirely sure about this, but better be a paranoiac ;)


Thanks for your thorough review.
I think I'll follow your suggestion and put it in the LSR.


Best,
  Harm

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





reply via email to

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