lilypond-user
[Top][All Lists]
Advanced

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

Re: Ossia at the first line of a PianoStaff


From: Jean Abou Samra
Subject: Re: Ossia at the first line of a PianoStaff
Date: Thu, 17 Feb 2022 20:32:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

Le 17/02/2022 à 19:01, Knute Snortum a écrit :
I have another problem that I'd love help with.  (Sorry for all the
questions lately.)

The piece of music I'm working on is a piano piece with several ossia
bars.  I've been researching how to do this and I've come across a
problem I can't fix.  If the ossia bar is the first bar of a new line,
the PianoStaff brace and bar span are attached.  In the middle of the
staff all is fine.

I've attached the code to produce the problem and an image of what it
produces.  Any help would be greatly appreciated.



The most low-tech fix would be to move the ossia context
out of the PianoStaff:

\version "2.22.1"

ossia = \markup \small \italic "ossia"


<<
  \new Staff = "ossia" \with {
    \remove "Time_signature_engraver"
    \hide Clef
    \hide BarLine
    \override BarLine.allow-span-bar = ##f
    \override KeySignature.stencil = ##f
    \magnifyStaff #2/3
  }
  \relative {
    \stopStaff
    s1
    \key c \minor
    \startStaff ees'4^\ossia g8 f ees2*1/2 \stopStaff
    s1*2
    \startStaff g4 ees8 f g2*1/2 \stopStaff
  }
  \new PianoStaff <<
    \new Staff = "upper" \relative {
      \key c \minor
      c'4 b c2
      ees4 f ees2
      g4 aes g2 % \break
      c4 b c2 \break
      g4 aes g2
      ees4 d c2
    }
    \new Staff = "lower" \relative {
      \key c \minor
      \repeat unfold 24 { \clef bass c4 }
    }
  >>
>>


If you not keen on doing this, here is another solution:

\version "2.23.6"

ossia = \markup \small \italic "ossia"

#(set-object-property! 'system-start-exclude 'backend-type? boolean?)

\layout {
  \context {
    \PianoStaff
    \override SystemStartBrace.before-line-breaking =
      #(lambda (grob)
         (ly:grob-set-object! grob
                              'elements
                              (ly:grob-list->grob-array
                               (filter
                                (lambda (g)
                                  (not (eq? #t (ly:grob-property g 'system-start-exclude))))                                 (ly:grob-array->list (ly:grob-object grob 'elements))))))
     \override SystemStartBrace.collapse-height = #0
  }
}


<<
  \new PianoStaff <<
    \new Staff = "ossia" \with {
      \remove "Time_signature_engraver"
      \hide Clef
      \hide BarLine
      \override BarLine.allow-span-bar = ##f
      \override KeySignature.stencil = ##f
      \magnifyStaff #2/3
      \override StaffSymbol.system-start-exclude = ##t
    }
    { \stopStaff s1*6 }

    \new Staff = "upper" \relative {
      \key c \minor
      c'4 b c2
      <<
        { ees4 f ees2 }
        \context Staff = "ossia" {
          \key c \minor
          \startStaff ees4^\ossia g8 f ees2*1/2 \stopStaff
        }
      >>
      g4 aes g2 % \break
      c4 b c2 \break
      <<
        { g4 aes g2 }
        \context Staff = "ossia" {
          \key c \minor
          \startStaff g4 ees8 f g2*1/2 \stopStaff
        }
      >>
      ees4 d c2
    }

    \new Staff = "lower" \relative {
      \key c \minor
      \repeat unfold 24 { \clef bass c4 }
    }
  >>
>>


The latter requires a development version due to ly:grob-list->grob-array
being a recent addition.

Best,
Jean




reply via email to

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