On Sat, Apr 26, 2014 at 11:54 AM, Knute Snortum <ksnor...@gmail.com> wrote: > Short version: I'd like to be able to pull in (import) several external ly > files into a multi-movement piece. > > Long version: > > I'm transcribing for Mutopia and we have several pieces where people like to > download one movement from a piece. For instance, I'm working on > Mussorgsky's Pictures at an Exhibition. Many people just want the Promenade > but I don't want make people download 10-14 files to get the whole piece. > Yes, we could zip them, but they would still have to print a dozen files and > there's no indication of order. > > What I'm wondering is if there is some way to create a LilyPond file > containing a book with several scores, where the source of the movements is > an external file. "includes" won't do. Something like this: > > \book { > \score { > import "./ly_files/promenade-1/promenade-1.ly" > } > \score { > import "./ly_files/gnomus/gnomus.ly" > } > ... > } > > Possible? On a wish list? Some other way to do it? > > If there's no good way to do it, I will probably write a Perl preprocessor > to do it.
Why won't includes work? This is actually how I prefer to work (rather than variables storing music). Here's an example: ===================================== \version "2.18.0" \include "defs.ily" instrument = "Horn in F" \include "header.ily" \score { \new Staff << { \include "mvt1/horn.ily" } { \include "mvt1/outline.ily" } >> } \score { \new Staff << { \include "mvt2/horn.ily" } { \include "mvt2/outline.ily" } >> } \score { \new Staff << { \include "mvt3/horn.ily" } { \include "mvt3/outline.ily" } >> } ===================================== I can use this file for the individual part, another for the piano part, and anther which compiles a multiple pieces together. (assuming a similar file structure: mvt1/horn.ily, mvt/outline.ily, mvt1/piano_right.ily, etc.) When typing out the score block becomes too repetitive I do something like this: ===================================== \version "2.18.0" ... includes ... makeGallayScore = #(define-void-function (parser location num) (string?) (let ((score #{ \score { \new Staff { \include #(string-append num ".ily") } } #})) (add-score parser score))) makeGallay = #(define-void-function (parser location low high) (number? number?) (do ((i low (+ i 1))) ((> i high)) (let ((n (format #f "~2,'0d" i))) #{ \makeGallayScore $n #}))) \makeGallay 1 40 ===================================== This was for a book of etudes. Each etude is the raw music in files named 01.ily through 40.ily. -----Jay _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user