lilypond-user
[Top][All Lists]
Advanced

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

\repeat unfold 0 times?


From: Pine, Zachary V
Subject: \repeat unfold 0 times?
Date: Wed, 27 Jan 2021 18:54:26 +0000

Hello All,

I have a little scheme function which gives me the number of times to repeat a particular bit of music in my composition. Sometimes I want that number to be zero and thus print no music at all.

I'm using the "\repeat unfold repeatcount" syntax. However, when repeatcount is zero, the music is still engraved one time.

I have found a way to use a scheme conditional to check if repeatcount is greater than zero before evaluating repeat. Here's the snippet: 

​\version "2.20.0"

m = #0
n = #1
o = #2


\new Staff {
  \repeat unfold #m dis'1
  #(let ((x #{ \repeat unfold #m dis1 #}))
        (if (> m 0) x))
  #(let ((x #{ \repeat unfold #n d1 #}))
        (if (> n 0) x))
  #(let ((x #{ \repeat unfold #o des1 #}))
        (if (> o 0) x))
}


I'm looking for a more elegant solution that doesn't have me going in and out of scheme and lilypond. Please offer me some suggestions.

Best,
Zachary Pine

reply via email to

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