lilypond-user
[Top][All Lists]
Advanced

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

Re: PDF file gets "-1" appended


From: Valentin Petzel
Subject: Re: PDF file gets "-1" appended
Date: Tue, 27 Jun 2023 21:17:38 +0200

Hello Knute,

so you are using books to allow specification of the midi filename. This is 
probably a fine usecase, but it still seems like a bit of an abuse of the book 
mechanic to me. Rather I’d adapt the midi output name logic itself.

This code adapts the internal function responsible for writing out the midi 
performances (scm/midi.scm:write-performances-midis) in such a way that

A) If we have multiple midi outputs all outputs are numbered starting with 1 
(instead of the first not being numbered and the next one starting with 1)
B) The numbering is padded to an equal length (so if you’ve got less than 10 
midis you number 1, 2, 3, ..., under 100 01, 02, 03, ...)
C) The midi performance title (if set midititle else title else "") (if set) 
is used as suffix.
D) The header property midiOutputSuffix may be used to override this suffix
E) The header property midiOutputFile may be used to override the full midi 
file name

This has the advantage over abusing Books that it specifies the names at the 
relevant position, not at a higher position.

Cheers,
Valentin

Am Dienstag, 27. Juni 2023, 16:39:53 CEST schrieb Knute Snortum:
> On Tue, Jun 27, 2023 at 2:35 AM Valentin Petzel <valentin@petzel.at> wrote:
> > Hello Knute,
> > 
> > I do not think this behaviour is particularly weird, rather the input is
> > weird.
> 
> Thanks for your replies.  Here is my slightly convoluted use-case.  Maybe
> there's a better way to do it.
> 
> I am engraving collections of pieces, such as Bach's 15 two-part
> inventions.  I want to be able to create a "book" with all the pieces in
> one PDF, but also to be able to print each piece individually.  And I want
> to be able to tweak the MIDI output, so I use \keepWithTag to do that.  So
> I have an "include" file something like this:
> 
> inventionOneMusic =
> \score {
>   \keepWithTag layout
>   % Notes
>   \layout {}
> }
> 
> inventionOneMidi =
> \score {
>   \keepWithTag midi
>   % Notes
>   \midi {}
> }
> 
> So now I can have a file called "invention-one.ly" that looks like this:
> 
> \inventionOneMusic
> \inventionOneMidi
> 
> ...and another that is the "book" called "15-two-part-inventions.ly" like
> this:
> 
> \inventionOneMusic
> \inventionTwoMusic
> % etc
> 
> \inventionOneMidi
> \inventionTwoMidi
> % etc
> 
> But now there's a problem.  I want one PDF but also the individual MIDI
> files named correctly.  As it stands I get files named like this:
> 
> 15-two-part-inventions.pdf
> 15-two-part-inventions.midi
> 15-two-part-inventions-1.midi
> etc
> 
> It's hard to tell which MIDI file belongs to which invention.  What I want
> is:
> 
> 15-two-part-inventions.pdf
> invention-one.midi
> invention-two.midi
> etc
> 
> The only way I could think of doing that is to wrap the MIDI score in a
> book and use \bookoutputFile:
> 
> inventionOneMidi =
> \book {
>   \bookOutputFile "invention-one"
>   \score {
>     \keepWithTag midi
>     % Notes
>     \midi {}
>   }
> }
> 
> So that's my use-case.  Maybe that isn't the best solution and one of you
> can come up with a better one.  Thanks for reading this long post.

Attachment: midi-title.ly
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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