Hi everyone,
I have a repository of scores that I organized in the following way:
- files with voices and lyrics variables (\soprano, \alto, ..., \text)
- files with templates (\header, \paper, \score are defined here)
- a Python script to help me generate a Makefile from a list of
mappings [ score A -> template B ]
The final lilypond command, executed by make, looks something like this:
cat template-159mm/head.ly \
src/my-song.ly \
template-159mm/template.ly | \
$(LILYPOND_CMD) --output=out/159mm/my-song -
There are some special cases that I am not able to handle in a generic
way. One of them is when I need to have more than one lyrics line under
a staff. In my 'template.ly' file, there is only one 'Lyrics' context,
using a '\text' variable from 'my-song.ly'. So, whenever I have more
than one lyrics line, I am not able to use the template and I need to
create somewhere a complete score definition.
I wonder if it is possible to declare an array-like variable in my score
file 'my-song.ly' and then add a loop in 'template.ly' to create the
needed number of 'Lyrics' contexts.
EXAMPLE WITH PSEUDO CODE
In 'my-song.ly':
textArray = <<
{ \new lyricmode { \set stanza = "1" fo -- o bar } }
{ \new lyricmode { \set stanza = "2" fo -- o bar } }
>>
and in 'template.ly':
\score {
<<
% ...
\ForEach item \textArray {
\new Lyrics \lyricsto "soprano" \item
}
>>
}
I seem to recall something similar being discussed on this list some
months ago, but now I am not able to find it anymore.
Should I include some Scheme code in my lilypond input files? But then,
how can I call lilypond functions like '\new lyricmode ...' from Scheme?
Regards,
Mauro