I'm trying to digitalize a score with LilyPond. I'm struggling with repetitions and acciaccaturas. I've simplified what I'm trying to achieve

original example

In this code

\version "2.24.1"

upper = \relative g'' {
  \time 3/4
  r2 c,4
  \repeat volta 2 { \acciaccatura e8 f2. }

lower = \relative f {
  \clef bass
  \time 3/4
  r2 c4
  \repeat volta 2 { d8[a'] c,4 c }

\score {
  \new PianoStaff
    \new Staff = "upper" \upper
    \new Staff = "lower" \lower
  \layout { }

But this renders incorrectly

Lilypond example

What am I doing wrong?


1 Answer 1


Why that ol' issue 34. It's a bug that has been problem for at least 15 years. I'll happen when you have a grace note at the start of some important bars, such as at the start of the score or a repeat.

This bug occurs because the grace note is "stealing" time from the preceding bar in the upper staff which pushes repeat barline backwards, but this shift isn't being accounted for in the lower staff.

For a work-around, all you need to do is to place an invisible grace note (e.g. \grace {s8}) in the other staff(s) at the same point in the score.

So, just change the last line in your lower block to:

\repeat volta 2 { \grace {s8} d8[a'] c,4 c }

If you have lots of staves (i.e. lots of different instruments playing), you might need to add lots of invisible grace notes.

N.B. Just because you have a real acciaccatura, don't be tempted to use invisible acciaccaturas in the other staves because they will introduce tiny little slurs that you don't want.

  • Heh, I didn't even know this was a bug. I just thought it was supposed to work this way...
    – Ramillies
    Mar 5, 2023 at 16:38
  • Issue #34 is about input that is fundamentally ambiguous (this particular case is on the more clear-cut side but many others aren’t), so not everyone considers it an actual bug. Mar 5, 2023 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.