lilypond-user
[Top][All Lists]
Advanced

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

Re: Variables when compiling a book


From: Knute Snortum
Subject: Re: Variables when compiling a book
Date: Tue, 3 Feb 2015 07:53:13 -0800

We at Mutopia.org have been struggling with the same issues, except that we have the extra condition that each separate piece in the collection should also compile on its own.  You can see our "flayelings" here: https://github.com/ksnortum/mp-sandbox


Knute Snortum
(via Gmail)

On Tue, Feb 3, 2015 at 7:10 AM, Christopher R. Maden <address@hidden> wrote:
On 02/03/2015 08:58 AM, John McWilliam wrote:
> You may be right in which case I will have to study your construct
> and apply it to my Piobaireachd tunes, however, I was hoping for a
> simpler solution. If you cannot see one then I suppose I must bite
> the bullet but I'm not very code literate so it may take time to
> affect the change.

Refactoring can be kind of annoying, but like any other kind of
infrastructure work, there comes a time when you can’t avoid it, and
it’s satisfying once it’s done.

A simple way to get started: If you use the same construct in two
different files, put it in its own file and \include it where you need
it, for example:

> all these user-defined music variables would also have to be lifted
> out of the Piobaireachd files and placed at the beginning of the
> collection file.

If these are used everywhere, then that makes sense to do.

If they are not, e.g. if they represent passages of music, then you can
leave them in situ.

Another way to think about this is that some LilyPond instructions
define things, and others do things.  E.g.:

theNotes = { c4 c c c }

defines a variable; it doesn’t make LilyPond generate any output.

\score { \theNotes \layout {} }

causes LilyPond to generate a PDF with some content.

If you want to reuse files, don’t mix these two kinds of things.

To go back to my example, atholl_highlanders_tune.ly defines a lot of
variables, but if you run LilyPond on it, there’s no output.  Meanwhile,
atholl_highlanders.ly and crism_tunes.ly both \include
atholl_highlanders_tune.ly, so that they have access to all the music
defined therein, but there’s no music defined in those files themselves,
just output.

It’s a bit of a pain in the neck to set up, but once you do, adding new
tunes is much, much easier.

~Chris
--
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
Surround hate and force it to surrender.
GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9  A210 4A51 DBAC 5C5C 3D5E

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user


reply via email to

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