lilypond-user
[Top][All Lists]
Advanced

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

lilypond: merging rests in polyphonic staff


From: Martin Lejeune
Subject: lilypond: merging rests in polyphonic staff
Date: Tue, 1 Sep 2015 22:59:38 +0200

Hi Everybody,
here's a newbie question.
I tried to configure "merging automatically" of rests in polyphonic staffs (piano) with a snipped, which I found in the manual.
It doesn't work. 
What's the mistake, any idea?

Thanks very much!

Cheers 
Martin

PS:

My example:

Attachment: Merging rests.ly
Description: Binary data

PNG image

\version "2.18.2"
\header {
  title = "merging rests"
}

global = { \time 4/4 }
Key = { \key g\major }

%% ------ Piano ------
rhUpper = \relative c''
{
  \voiceOne 
  \Key
  R1*4
g4 r8 g r2 |
}

rhLower = \relative c' {
  \voiceTwo
  \Key
R1*4
b4 r8 b r2 |
}

lhUpper = \relative c' {
  \voiceOne 
  \Key
  R1*4 |
  g4 r8 g r2 | 
}
lhLower = \relative c {
  \voiceTwo
  \Key
  R1*4|
  d4 r8 d r2 | 
}

PianoRH = {
  \clef treble
  \global
  \set Staff.midiInstrument = #"acoustic grand"
  <<
    \new Voice = "one" \rhUpper
    \new Voice = "two" \rhLower
  >>
}
PianoLH = {
  \clef bass
  \global
  \set Staff.midiInstrument = #"acoustic grand"
  <<
    \new Voice = "one" \lhUpper
    \new Voice = "two" \lhLower
  >>
}

piano = {
  <<
    \set PianoStaff.instrumentName = #"Piano"

    \new Staff = "upper" \PianoRH 
    \new Staff = "lower" \PianoLH
     \set Staff.shortInstrumentName = #"p"
  >>
}


\score {
  
  <<
   \new PianoStaff = "piano" \piano
    >>
 
  \layout {
    \context { \Staff \RemoveEmptyStaves }
    \context {
      \Score
      \override BarNumber.padding = #3
      skipBars = ##t
    }
  }
}




the snippet doesn't work:

Attachment: Merging rest Snippet.ly
Description: Binary data

PNG image

\version "2.18.2"
 \new Score {
   <<
    \new Staff  <<
      s4-\markup{ LilyPond default, rests in both voices. }
      \relative c'' { c4 d e r | r2  e4 g | R1 } 
      \\
      \relative c'' { c4 b a r | r a g2   | R1 }
    >>       
    \new Staff \with {
      \override RestCollision.positioning-done = #merge-rests-on-positioning
    } 
    <<
      s4-\markup{Merge rests as per standard notation practice.}
      \relative c'' { c4 d e r | r2  e4 g | R1 } 
      \\
      \relative c'' { c4 b a r | r a g2   | R1 }
    >>   

 }  
}
  \layout {}
  \midi {}
}


reply via email to

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