lilypond-user
[Top][All Lists]
Advanced

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

Re: Pull in external LilyPond files into a score of movements


From: Knute Snortum
Subject: Re: Pull in external LilyPond files into a score of movements
Date: Sat, 26 Apr 2014 15:22:11 -0700

Okay, that looks good.  But there are two things:  First, can the files be *.ly files instead of *.ily files?  And if not, will *.ily files compile standalone?  (People will still want to download just one movement.)  Second, when I tried to use includes, I got a message saying it couldn't find the file.  Then it gave me a search path for the includes.  None of them were the current directory (.).  If I have to put the files in some standard include directory, it's not going to work.

Thanks for your input. 


Knute Snortum
(via Gmail)


On Sat, Apr 26, 2014 at 12:57 PM, Jay Anderson <address@hidden> wrote:
On Sat, Apr 26, 2014 at 11:54 AM, Knute Snortum <address@hidden> 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


reply via email to

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