lilypond-user
[Top][All Lists]
Advanced

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

Re: Array variables and loops (for lyrics)


From: Mauro Levra
Subject: Re: Array variables and loops (for lyrics)
Date: Fri, 15 Sep 2023 18:54:31 +0200
User-agent: Mozilla Thunderbird

Wonderful! Thank you very much. It works perfectly.

Is is possible to conditionally execute the #@ expression based on whether the 'textArray' variable is bound? I have tried, but I have not succeeded. As a workaround I have defined an empty 'textArray' in my head.ly which is sometimes redefined by my-score.ly

On 15/09/2023 17:41, Jean Abou Samra wrote:
Hi,

Try

\version "2.24.2"

textArray = <<
   { \lyricmode { \set stanza = "1" fo -- o bar } }
   { \lyricmode { \set stanza = "2" fo -- o bar } }


\score {
   <<
     \new Voice = "soprano" { c'1 1 1 }
     #@(map (lambda (mus) #{ \new Lyrics { \lyricsto "soprano" { #mus } } #})
            (ly:music-property textArray 'elements))
   >>
}


You may want to read
https://extending-lilypond.gitlab.io/en/extending/intro.html#inserting-scheme-inside-lilypond
about the #@ operator.

Best
Jean




reply via email to

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