Hello,

I've been given a short item to realise in Lilypond and it includes a layout problem that I haven't been able to solve.

Basically, it is a piano piece in which, after a bit, a part for chimes is added:  i.e., another staff above the piano's treble part a few bars in as in my MWE.  I have tried to do this as an ossia staff in testlayoutB.ly  but it produces the result testlayoutB.pdf which starts the chimes part at the beginning of the example, not where I want it to start.

Comments in my .ly refer to a semicolon being commented out and reinstated just above the piano Bass clef part.  This causes the chimes and piano treble second line line to begin where I want it to, but it is placed below the bass, with a spurious clef above the bass.

What I would really like to do is to use StaffGroup as in testlayoutA.ly but this fails with a fatal error: "\new StaffGroup  %Fatal error: 'spurious expression in \score'", so Lilypond rejects this kind of construction.

I have a voice & piano piece of my own which changes the number of staves in the piano part, so I'm very keen to learn how to deal with changing numbers of staves in a score.

Thanks!

Archer

%testLayoutB.ly
\version  "2.24.3"

\header {
  title = "Test Layout" 
}

transparentrest = \once \override Rest.transparent = ##t
transparentMMrest = \once \override MultiMeasureRest.transparent = ##t

\score {

 \new PianoStaff 
 <<
  % TREBLE CLEF 1st system
  \new Staff  = "pluschimes" {
    \time 4/4
    \clef treble
    
    \repeat unfold 2 {d'2 f'2 | g'2 bes'2 | }
    \break
    
  % TREBLE CLEF 2nd system
    R1 | \stopStaff s4 
    \once \override TextScript.extra-offset = #'(0.5 . -5.0)
    s2.^\markup { 
    \override #'(line-width . 50 )
    \wordwrap {\italic{\small{A lot more more text placed in here}}}} | s1| s1 | s1 |
    \startStaff
    \time 3/4 \tempo 4 = 60 r2. \bar "!" 
  } % If this } is commented out and put just above the Bass Clef (see 
    %  %} there, a spurious staff and ossia staff above it appears 
    %  BELOW the second system ...
   
  % OSSIA STAFF ABOVE PianoStaff FOR CHIMES (meant to start at 2nd system)
  \new Staff = "chimes"  \with {
      \remove "Time_Signature_Engraver" 
      alignAboveContext = "pluschimes"
      \context Staff
      \magnifyStaff #2/3       
      fontSize = #-2
     }
         
    { s4^\markup{\small {\column{\line{[Orchestral Chimes if} \line{ available (B\flat - C only)]}}}} \stopStaff s2. | \transparentMMrest R1 | \transparentMMrest R1 | \transparentMMrest R1 |
    \once \override TextScript.extra-offset = #'(-1.0 . -7.0)
    \transparentMMrest R1^\markup {
         \override #'(line-width . 20 )
         \wordwrap {\italic{\small{Some text here}}}} | 
    \revert Score.TimeSignature.stencil
    \startStaff \time 3/4 bes'2\mp bes'4 | 
   }
  %} % semicolon reinstated here
  
  % BASS CLEF 1st system
     \new Staff {
     \time 4/4
     \clef bass
     
     \repeat unfold 16 {g,8[ g,]} 
     \break
    
  % BASS CLEF 2nd system     
     \repeat unfold 16 {g,8[ g,]} 
  }
 >>
}
%testLayoutA.ly
\version  "2.24.3"

\header {
  title = "Test Layout" 
}

transparentrest = \once \override Rest.transparent = ##t
transparentMMrest = \once \override MultiMeasureRest.transparent = ##t

\score {

 \new PianoStaff 
 <<
  % TREBLE CLEF
  \new Staff {
    \time 4/4
    \clef treble
    
    \repeat unfold 2 {d'2 f'2 | g'2 bes'2 | }
    \break
  }
    
  % BASS CLEF
  \new Staff {
    \time 4/4
    \clef bass
     
    \repeat unfold 16 {g,8[ g,]} 
    \break
  }
 >>
  
 \new StaffGroup  %Fatal Error:  'Spurious expression in \score'
   << 
     % EXTRA STAFF ABOVE PianoStaff FOR CHIMES
   \new Staff = "chimes"  \with {
       \magnifyStaff #2/3
       \remove "Time_Signature_Engraver" 
       fontSize = #-2
     }
       
     { s4^\markup{\small {\column{\line{[Orchestral Chimes if} \line{ available (B\flat - C only)]}}}} \stopStaff s2. | \transparentMMrest R1 | \transparentMMrest R1 | \transparentMMrest R1 |
     \once \override TextScript.extra-offset = #'(-1.0 . -7.0)
     \transparentMMrest R1^\markup {
       \override #'(line-width . 20 )
       \wordwrap {\italic{\small{Some text here}}}} | 
     \revert Score.TimeSignature.stencil
     \startStaff \time 3/4 bes'2\mp bes'4 | 
   }

  \new PianoStaff
  <<
   \new Staff {
    \time 4/4
    \clef treble    

    % TREBLE CLEF
     R1 | \stopStaff s4 
     \once \override TextScript.extra-offset = #'(0.5 . -5.0)
     s2.^\markup { 
     \override #'(line-width . 50 )
     \wordwrap {\italic{\small{A lot more more text placed in here}}}} | s1 | s1 | s1 |

     \startStaff
     \time 3/4 \tempo 4 = 60 r2. \bar "!" 
     }
    
     % BASS CLEF
    \new Staff {
     \time 4/4
     \clef bass
     
     \repeat unfold 16 {g,8[ g,]} 
    }
   >>
  >>
 }

Attachment: testLayoutB.pdf
Description: Adobe PDF document

Reply via email to