lilypond-user
[Top][All Lists]
Advanced

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

\score blocks in included files


From: gnomino
Subject: \score blocks in included files
Date: Wed, 27 Dec 2006 22:11:07 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Hello,

I'm typesetting instrumental music, and am trying to produce one file for each
instrument, and one file for the conductor's score (for which the input file
includes all the other input files). I put the music for each instrument into a
separate file, and intend to run lilypond on each individual .ly file to
generate the score defined in that file. I created the following music function
to detect whether or not the current file is being included by another file (the
conductor's score file):

%% returns the music expression only if this is the toplevel file
iftop = #(define-music-function (parser location music) (ly:music?)
        (if (let* (
                (filename (car (ly:input-file-line-char-column location)))
                (output (ly:parser-output-name parser))
                (outlen (string-length output)))
        (or 
                (string=? filename output)
                (and
                        (> (string-length filename) outlen)
                        (char=? #\. (string-ref filename outlen))
                        (string=? output (substring filename 0 outlen))
                )
        ) music (make-music 'SequentialMusic 'void #t))))

However, lilypond won't let me apply this function to a \score block, nor will
it let me save the \score block to a variable, then apply it to that variable.
I've tried applying this function to only the music inside the \score block, but
then I can't prevent duplication of \header blocks. It'll probably let me apply
this function to a score created with ly:make-score, and I know that I can
always create two files for each instrument, one with the music and one with the
\score block, but is there any easier way to do what I'm trying to do? Surely
it's not uncommon to want to produce multiple files for instrumental scores? Or
am I just not doing it the right way?





reply via email to

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