[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Programmatically building music-function names
From: |
Urs Liska |
Subject: |
Re: Programmatically building music-function names |
Date: |
Fri, 15 Jan 2016 19:01:16 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
Am 15.01.2016 um 18:06 schrieb Chris Yate:
> Hi,
>
> I'm trying to typeset a number of short pieces into multiple scores in
> one file. I can do this manually, as:
> ...
>
> I've attached a ly file including the code I've pasted here.
>
> thanks,
>
> Chris
>
Hi Chris,
I think (if I didn't misunderstand you) you can achieve what you want
very easily, without any Scheme.
file: score.ily
\score {
\new Staff \myMusic
}
###
file: music-1.ily
myMusic = { c' }
###
file: music-2.ily
myMusic = { d' }
###
file: my-score.ly
\include "music-1.ily"
\include "score.ily"
\include "music-2.ily"
\include "score.ily"
##################
The idea is that the score expects a certain music variable, and every
time you include that score block it will take what is currently
attached to that name.
You can also take a slightly different approach that *may* be helpful in
more complex situations:
Take the same score.ily and then write
musicOne = { c' }
musicTwo = { c' }
myMusic = \musicOne
\include "score.ily"
myMusic = \musicTwo
\include "score.ily"
You can use that assignment (myMusic = ...) to compose the music
variables for the score block. Such an adaptor pattern can be handy for
supporting different transpositions, for example.
HTH
Urs