lilypond-user
[Top][All Lists]
Advanced

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

Re: Conditionally including lyrics


From: Johan Vromans
Subject: Re: Conditionally including lyrics
Date: Fri, 02 Dec 2011 12:36:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Marc Hohl <address@hidden> writes:

> Has someone an idea
> how to create a loop which scans for textA, textB, textC etc. and puts
> a command that acts like
> \addlyrics for each hit?

This is exactly what I do in my LP templates :)

I just define 

 highMusic
 leadMusic
 highWords
 highAWords
 highBWords
 
and so on, and the templates will process exactly what has been defined,
leaving out the undefined parts.

I found \ifDefined and friends (attached) helpful to write the templates.

So it boils down to something like:

    % Add lyrics if requestes.
    \ifDefinedThen \leadWords  \new Lyrics \lyricsto \voiceName \ifDefined 
\leadWords
    \ifDefinedThen \leadAWords \new Lyrics \lyricsto \voiceName \ifDefined 
\leadAWords
    \ifDefinedThen \leadBWords \new Lyrics \lyricsto \voiceName \ifDefined 
\leadBWords
    \ifDefinedThen \leadCWords \new Lyrics \lyricsto \voiceName \ifDefined 
\leadCWords

So it is not exactly scanning, but there's no problem in adding as many
cases as necessary.

The real templates are more generic than the above example.

BTW: I'd be happy to share these templates to LSR but the snippet repo
(still) cannot handle template collections.

-- Johan

Attachment: ifdefined.ly
Description: Binary data


reply via email to

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