lilypond-user
[Top][All Lists]
Advanced

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

Re: When (in seconds) does each page begin?


From: Matt Wallis
Subject: Re: When (in seconds) does each page begin?
Date: Thu, 4 Jun 2020 07:56:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 02/06/2020 11:30, Thomas Morley wrote:
Am Di., 2. Juni 2020 um 10:19 Uhr schrieb Valentin Villenave
<valentin@villenave.net>:
On 5/30/20, Matt Wallis<m7956@acumen-it.co.uk>  wrote:
But I'd still like to know how to find out when a page of a score begins
Well, there is something to be done with the 'page-number and
'rank-on-page properties, as demonstrated in this regtest:
https://git.savannah.gnu.org/cgit/lilypond.git/plain/input/regression/multi-measure-rest-reminder.ly

The problem is that the page-breaking algorithm runs fairly late in
the process, so whenever I try adding that to the aforementioned
Grob_metadata_engraver, either ly:grob-system doesn’t return anything
or it remains stuck on 0.  (The regtest I mentioned works around that
in a pretty convoluted way, by creating a new grob and then suiciding
it.)

You might want to have a look; maybe your guess’s gonna be better than mine.

Cheers,
-- V.

I think best bet would be to post-process the final file.
We already have a post-process-hook (see Application Usage). Below I
use it to print the first BarNumber of each page. If you know the used
\tempo it should be straight forward to calculate the passed seconds.
Ofcourse any calculation of passed time fails if multiple scores are
in the file. The provided procedure is not able to distinguish.

Here the code (example_has_  multiple scores)
Output is done in terminal, output to a .log-file is possible as well,
see comment.

\version "2.19.32"

#(define* (print-pages-first-bar-numbers layout pages #:optional print-to-file)
;; If `print-to-file' is set #t the output is written to a file
;; otherwise usually displayed in Terminal
   (let* ((lines (map (lambda (page) (ly:prob-property page 'lines)) pages))
          ;; list of systems of each pages

Thomas - thank you very much for this. I will look at it in depth some time soon. Right now, I'm modifying the code I've cloned from

https://gitlab.com/sigmate/lilypond-html-live-score

This has 'distracted' me from my original plan, and the pressing need to identify "when (in seconds) does each page begin". :-)

At some point, I'll make available a fork of the repo, to show what I've been doing.

All the best, Matt.



reply via email to

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