1

I'm scoring Bach BWV927 in LilyPond. For each hand, at various measures there are two voices. The left-hand second voice starts in the first measure, but the right-hand second voice starts in the third measure.

At the moment, I'm adding rests to position the right-hand second voice correctly, but I don't want its rests to appear. How do I start a voice in a specific measure?

\version "2.20"

\header {
  title =   "Prelude in F - BWV 927"
  subtitle = "Kleine Praledien Fughetten. 8"
  composer =    "J.S. Bach (1685-1750)"
}

global = {
  \key f \major
  \time 4/4
  \tempo 4 = 28
}

rightvoiceone =  {
  \relative b' {
    r16 c16 a c f,  c' a c f,  d' bes-3 d f, d' bes d |

    g,-1 e'-5 bes-2 e g, e' bes-2 e-4  f c-2 a c-3 f,  r8. | 

    r8 f' f f r8 f f f | \break

    r8 g bes g a4 r4
   \bar "|."
  }
}

rightvoicetwo =  {
  \relative b' {
    R1 | R1 | 

    r8 c a c r8 d bes d | \break

    r8 e e e <c f>4 r4
  }
}

leftvoiceone =  {
  \relative c {
    \stemDown
    f8 f8 f8 f8 r8 f8 f8 f8 | 

    r8 f8 f8 f8 f4 r16 c'16 a16 c16 | f,16 c' a c f, c' a c f, d' bes d f, d' bes d | 
    g, e' bes e g, e' bes e f c a c f, c a c |
  }
}

leftvoicetwo =  {
  \relative c' {
    \stemUp
    a8 c8 a8 c8 r8 d8 bes8 d8 | r8 g,8 bes8 g8 a4 
  }
}

\score {
   \context PianoStaff << 
    \context Staff = "rh" <<
      \global
      \clef "treble"
      \new Voice = "rhfirst"
         { \voiceOne \rightvoiceone }
      \new Voice = "rhsecond"
         { \voiceTwo \rightvoicetwo }
    >>
    \context Staff = "lh" <<
      \global
      \clef "bass"
      \new Voice = "lhfirst"
         { \voiceOne \leftvoiceone }
      \new Voice= "lhsecond"
         { \voiceTwo \leftvoicetwo }
    >>
  >>
  \layout { }
  \midi { }
}

Image of score generated by above code

1

What's actually going on here is that there are three voices: the top voice (right hand), the bottom voice (left hand), and a middle voice that switches between the two hands.

However, to keep your current scoring (more or less), you have two options:

  1. Use \hideNotes and \unHideNotes;
    (Also, in rightvoicetwo, the capital Rs should be lowercase.)
    (LilyPond Notation Reference)
rightvoicetwo =  {
  \relative b' {
    \hideNotes
    r1 | r1 | 
    \unHideNotes
    r8 c a c r8 d bes d | \break

    r8 e e e <c f>4 r4
  }
}
  1. Use s (spacer, a.k.a. "invisible rest") instead of r (rest).
    (LilyPond Notation Reference)
rightvoicetwo =  {
  \relative b' {
    s1 | s1 | 

    r8 c a c r8 d bes d | \break

    r8 e e e <c f>4 r4
  }
}
1
  • Cool - invisible rests!
    – timbo
    Jun 19 at 1:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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