My Lilypond score consist of repeat snippets a few bars each. I need to show the snippet number as markup. The score is being updated regularly by inserting new snippets, hence the snippet number should increment automatically, rather than being hard-coded:
snippetNumber = 0
snippet = #(define-music-function)
(music)
(ly:music?)
#{
% How do I increment the snippetNumber variable here?
\textMark #(number->string snippetNumber)
\repeat volta 2 {
#music
}
#})
\snippet { c8 e fis e d fis gis fis }
\snippet { c a f cis d b g dis }