lilypond-user
[Top][All Lists]
Advanced

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

Counter in a repeat


From: John Schlomann
Subject: Counter in a repeat
Date: Fri, 28 Jul 2017 11:22:22 -0500

Hello Everyone,

I’d like to maintain a counter that can track the current number of passes through a repeat, something like this:

\version "2.18.2"

 

rpt-number = 0  % Initialize the counter

{

  \repeat unfold 3 {

    #(set! rpt-number (1+ rpt-number))  % Increment the counter

    c'4 e'4 g'4 c''4

  }

}

 

Is there any way to do such a thing? My purpose, which is not apparent here, is to use the counter to build symbols used with tags, so that I can select different tagged parts as the repeat unfolds. In my case, the content of the repeat would essentially be an entire hymn stanza.

As this code stands, the counter is incremented once, and that value (1), will be used throughout all repeats.

I’m always amazed at the power and elegance of LilyPond, but this may be asking for something it wasn’t designed for. Thank you for any help.

John

 

 


reply via email to

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