lilypond-user
[Top][All Lists]
Advanced

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

Re: Scoped variables


From: Jan-Peter Voigt
Subject: Re: Scoped variables
Date: Mon, 4 Nov 2019 13:58:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Peter,

in the article Kieren mentioned, I tried to summarize some thoughts
around the multi-movement issue and some more.
You can find the corresponding templating engine at:
https://github.com/openlilylib/lalily-templates

That framework does a lot to do things automagically. But probably this
is too much for your needs. So one key point is that a template is
basically a music-function. If one defines variables like timothy proposed:

I.violinI = { ... }
I.violinII = { ... }
II.violinI = { ... }
II.violinII = { ... }

and defines a music-function

TwoVlns = #(define-music-function (mvt)(list?)
             #{
               <<
                 \new Staff { $(assoc-get 'violinI mvt) }
                 \new Staff { $(assoc-get 'violinII mvt) }
               >>
             #})

the music can instantiated like the following:

\score {
\TwoVlns #I
}
\score {
\TwoVlns #II
}

In the framework are functions defined for storing and getting music
that prevent a failure if some music is not defined (yet), but logs a
warning about missing music.

So if you have questions don't hesitate to contact me!

Best regards
Jan-Peter


Am 04.11.19 um 13:03 schrieb Peter Toye:
> Kieren,
>
> That looks great at a first skim-through. Thanks.
>
> Best regards,
>
> Peter
> mailto:address@hidden
> www.ptoye.com <http://www.ptoye.com>
>
> -------------------------
> Monday, November 4, 2019, 11:06:55 AM, Kieren MacMillan wrote:
>
> *> Hi Peter,
>
>>> If a publisher wanted to collect Mr. Lanfear's string quartets (assuming 
>>> that he has written more than one) into a single volume, the Lilypond code 
>>> would have to be changed to rename all of the variables to something like 
>>> QiIViolinI
>
>> In the engraving of my larger works (operas,
>> musicals, multi-movement concert works, etc.),
>> I’ve done exactly that. It’s only a small bit of extra effort.
>
>>> Now you can have a directory/file structure like:
>
>>> Book
>>>   Book.ly
>>>   Quartet1
>>>     Movement1
>>>       Score.ly
>>>       Violin1.ly
>>>       ...
>>>     Movement2
>>>       Score.ly
>>>      
>>> etc.
>
>> Have you looked at Jan-Peter’s templating
>> system (cf.
> *> http://lilypondblog.org/2014/07/trees-music-and-lilypond/
> <http://lilypondblog.org/2014/07/trees-music-and-lilypond/>
> *> and other links)? I think it does exactly what you’re talking about.
>
>> Hope that helps!
>> Kieren.
>



reply via email to

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