On Mon, 2023-12-04 at 14:48 -0600, Karlin High wrote:
> On 12/1/2023 2:21 PM, Stefano Antonelli wrote:
> > trying to modify ly2video to produce a different kind of video
> 
> Have you seen Knut Petersen's MKVIDEO project?

I have, but thanks for the suggestion.  MKVIDEO is not nicely
distributed (no git repo) so I didn't have a good look.

The problem with every lilypond video generation solution I've come
across:

ly2video
lilypond-html-live-score
LilypondToBandVideoConverter [1]
MKVIDEO

and even this unreleased one:

https://www.youtube.com/watch?v=JqwrqhPQIWQ

Is that page transitions are abrupt.  It's hard to follow the music
when the page transitions and you can't read ahead.  For my intended
use, it's not good enough.

I know that ly2video can scroll the music and leave the cursor
stationary, but that's not a good solution to this problem either.

Seeing two lines of music at a time is the right solution for me: the
current line and the next line.  At least on my phone's screen.

Really lilypond-html-live-score is quite impressive.  I like how they
use svg elements instead of png.  If the page would scroll
automatically while the music was playing it would very useful to me.
 At the same time, I would prefer a video to an html page.  It's easy
to slow a video down to learn more difficult parts.

However, ly2video seems to be the only solution that will take a
beatmap file to sync up audio with the notation.  It's called midi-
rubato and this is crucial for the kind of scrolling video scores that
I'm interested in making.

lilypond-html-live-score uses an engraver with /consists like event-
listener.ly. ly2video uses the after-line-breaking callback.

The problem is that the line breaks and page breaks don't have such a
callback.

Having a closer look at mkvideo, it's using after-line-breaking as
well.  But I noticed something interesting:

\paper {
    #(define (page-post-process layout pages)
         (after-pb-processing layout pages))
}

earlier, after-pb-processing is defined.  So I copied that definition
with my own alteration:

#(define (after-pb-processing layout pages)
    (format #t "\nafter-pb-processing"))

I ran lilypond.  There were no complaints and after-pb-processing did
print at the very end.  Once.  There are two pages though so I expected
to see it twice.

I don't know how I missed page-post-process before.  The documentation
says:

page-post-process (procedure)

If this function is defined (within the \paper block), LilyPond uses it
to post-process pages, for example, to extract the table of contents
and writing the information to an auxiliary file.  The call happens
after page breaking has been performed.

The syntax is
#(define (page-post-process layout pages) ... )

It would seem that page-post-process is called after all the page
breaking is performed.  I need something called when each page break is
performed.

I had a look at where page-post-process was used, in paper-book.cc, but
I didn't see anything else.  By the time it's at 'book' it's probably
too late.  I found page-breaking.cc which looked promising, but there's
no callback defined in there.  And the comments indicate that the page
chunking code is done before any drawing.

I also took a look at LilypondToBandVideoConverter, but it's pretty
complicated.  Ultimately he's using /consists with engravers too.
 Nothing about page breaks.

Unfortunately another dead end, but I appreciate the reply nonetheless
Karlin.

Thanks,
Stef

[1] I haven't seen LilypondToBandVideoConverter mentioned on this list
so I'm not sure many know about it.

Code:
<https://github.com/prof-spock/LilypondToBandVideoConverter.git>

Write up by author:
<
https://www.tensi.eu/thomas/music/produce_like_a_nerd/produce-like-a-nerd_1.html
>

demo from the above write up:
<
https://www.tensi.eu/thomas/music/produce_like_a_nerd/media/plan-wonderful_song.mp4
>

Reply via email to