On Tue, 2023-12-12 at 11:00 +0100, Jean Abou Samra wrote:
> > cat first.ly second.ly third.ly > out.ly
> > lilypond out.ly
> > But it's not portable.  I'd have to do the equivalent in python if
> > there's no way to do it with lilypond.
> 
> Not sure I understand the need, why do you need to append at the end,
> as opposed to prepending with -dinclude-settings? (There is no
> equivalent of -dinclude-settings to append.)

Mainly to override the \paper and \header blocks that are in the user's
ly file.  Because later definitions will replace earlier ones.
 Especially in the case of \override.  I think.

At the moment ly2video removes the whole \paper block (it searches and
matches { and }) and then adds it's own.  Whereas, it should be
possible to 'reset' all \paper blocks by appending one to the end.

Speaking of which, is there a way to reset an entire block to defaults
that doesn't require setting each individual property?

For the \header block, it would be enough to suppress printing of the
header fields and any header or footer if there were functions to do
so.  Rather than changing \header values to #f.  That would work better
when \header is defined at the \score level.

The \paper block, as I'm now reading, can be placed in three different
places (descending hierarchy).  So it would suffer from the same
problem as \header.  A single \paper block appended to the end of the
user's ly file isn't robust enough.  At the same time deleting \paper
blocks from the input file doesn't work with \paper blocks included
from other files.

Also to place other things like changing the staff size.  The user
could have placed:

#(set-global-staff-size 40)

in their song.ly (or in some included file) and ly2video wants to set
it back to the default:

#(set-global-staff-size 20)

The last thing ly2video does that I'm struggling with is ly2video
removes any \bookOutputName that it sees.  Presumably this is to make
sure the name of the midi or pdf/png filename doesn't change.  The user
could, for example, supply a file that looks like this:

\header {
  title = "File title"
  midititle = "midi title"
}
music = \relative c' {
  c1
}
\book {
  \bookOutputName "pdf_file_only"
  \score {
    \new Staff \music
  \layout {}
  }
}
\book {
  \bookOutputName "midi_file_only"
  \score {
    \new Staff \music
  \midi {}
  }
}

In this case, ly2video would process it fine *if* the \bookOutputNames
were deleted (which is what it does).  It's the same music in both
cases, so the png output and the midi output would match.  Especially
with that unroll repeats magic you posted earlier prepended.

I found that example in the answer to a stackoverflow question about
how to name the pdf and midi files differently.  I don't know if it's
common "out in the wild".

The removal of \bookOutputNames precedes hosting ly2video on github.
 It's in the initial zip file import from Nov 17, 2012.  I don't know
why it was added.

I don't want to break any existing functionality.  And some of the
existing functionality doesn't work when it comes from included files
and ly2video can't see it.


Reply via email to