I have a software development background, but I'm new to LilyPond. I'm trying to create a function that will allow me to pass in a number and then return some text depending on which number is passed in.
Example: \getStanza 2
#(define-scheme-function
(stanza)
(number?)
#{
% conditional code goes here
#}
I've tried this:
(
cond ((#stanza 1) \lyricsStanzaOne)
cond ((#stanza 2) \lyricsStanzaTwo)
cond ((#stanza 3) \lyricsStanzaThree)
)
And this:
\if (#stanza 1) \lyricsStanzaOne
\if (#stanza 2) \lyricsStanzaTwo
\if (#stanza 3) \lyricsStanzaThree
But I get an "ignoring non-music expression" warning and the lyrics for stanza one are returned, preceded by the word "if" or "cond" depending on which code block I try to use.
The LilyPond documentation doesn't provide much in the way of examples, so it's been a lot of trial and error just to get this far.