lilypond-user
[Top][All Lists]
Advanced

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

Stopping LilyPond from merging a note head and rest


From: Knute Snortum
Subject: Stopping LilyPond from merging a note head and rest
Date: Tue, 30 Sep 2014 08:20:16 -0700

I am getting the message, "warning: cannot have note heads and rests together on a stem" in the code below.  I want the g-sharp, e chord to line up with the bass b-flat and the inner voice's rest on the first beat to be shifted a little to the right.  I have tried shifting the rest and the chord, and using force-hshift, but LilyPond seems to always want to merge the chord and the rest.  Suggestions?

%%% -- Begin
\version "2.18.2"
\language "english"

shiftRest = \once \override Rest.X-offset = #1

global = {
  \time 2/4
  \numericTimeSignature
  \key c \major
}

upperStaffTop = \relative c'' {
  <<
    {
      s4 <d d'>8 r |
      <d' d'>8 r r4 |
    }
    \\
    {
      \shiftRest r4 d,,8 r |
      d'8 r r4 |
    }
  >>
}

upperStaffBottom = \relative c'' {
  %% "warning: cannot have note heads and rests together on a stem"
  \shiftOn <e gs>2 \shiftOff |
  s2 |
}

lowerStaffTop = \relative c' {
}

lowerStaffBottom = \relative c, {
  bf2 ~ |
  bf2 |
}

upperStaff = {
  \clef treble
  \global
  << { \upperStaffTop } \\ { \upperStaffBottom } >>
}

lowerStaff = {
  \clef bass
  \global
  << { \lowerStaffTop } \\ { \lowerStaffBottom } >>
}

\score {
  \new PianoStaff <<
    \new Staff = "upper" \upperStaff
    \new Staff = "lower" \lowerStaff
  >>
  \layout {
  }
  \midi {
  }
}
%%% -- End

Knute Snortum
(via Gmail)

reply via email to

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