I did just that a while ago. Here's the script I used (I had a few
additional parameters, though):
```
#(define (movement title suffix music)
(list
#{\bookpart {
\header { title = #title }
\score { \removeWithTag midi $music \layout {} }
}#}
#{\book {
\header { title = #title }
\bookOutputSuffix #suffix
\score { \removeWithTag midi $music \layout {} }
\score { \unfoldRepeats \removeWithTag nomidi $music \midi {} }
}#}
))
$@(movement "Part 1" "part_1" partOne)
$@(movement "Part 2" "part_2" partTwo)
$@(movement "Part 3" "part_3" partThree)
```
This places each part on a new page, though, due to using \bookparts. If
you don't want that, you could add each \score to a list and then insert
each of them into a \book at the end.
On 07/20/2017 11:40 PM, Jérôme Plût wrote:
I am typesetting a multi-movement work. I want the paper output to be
in a single file (say work.pdf) and the MIDI output to be in separate
files (work-1.pdf, work-2.pdf). Is there a simple and local way to do
this?
I can do it in a not-simple-enough way:
first = \relative { c'4 c c c }
second = \relative { c'4 d e f }
\book {
\score { \new Staff << \first >> }
\score { \new Staff << \second >> } % here
}
\book { \bookOutputSuffix "1"
\score { \new Staff << \first >> \midi { } } }
\book { \bookOutputSuffix "2"
\score { \new Staff << \second >> \midi { } } } % and here
However, this is not *local*. What I mean is that if I want to comment
out, say, the second movement (for a test run), I need to comment two
places at once (marked “here” “and here” in the source above). For
consistency and efficiency, I want all lines relating to a single
movement to be grouped together. Besides, I also have some reasons to
want to group the source of the music with the \score commands; my
preferred file structure would be:
% first movement
music = \relative { ... }
\score { ... } % paper output to work.pdf
\score { ... } % MIDI output to work-1.midi
% second movement
music = \relative { ... }
\score { ... } % paper output appended to work.pdf
\score { ... } % MIDI output to work-2.midi
I also tried a variant, resetting the name of the book:
\book { \bookOutputName "work" \score { \new Staff << \first >> } }
\book { \bookOutputName "work" \score { \new Staff << \second >> } }
There would be two consistent ways to act here: the second score
could either overwrite the first one or add some extra pages.
(Concatenation would be more useful, obviously). However lilypond
chooses a bizarre third option: the code above produces two files
named work.pdf and work-1.pdf .
Does this problem have any solution?
Thanks,
--
Jérôme Plût
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user