Hello,

I'm still fighting against the problem of setting a vertical gap between
two pedal spanners. Or, in general, between two spanners.
I find *very* strange there's not such a feature in Lilypond, which is IMHO
very important and it currently can be implemented only (in a uncomfortable
way) with a redundant Dynamics layer. Or by modifying the \sustainOn
function in a way that it has to be placed before a note (which can cause
messy syntax).

The only hack I could implement, that preserves Lilypond's syntax, is the
following code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LilyBin
#(define addGap #f)
#(define currPed "")
#(define pedid 0)

{

  \set Staff.pedalSustainStyle = #'mixed

  \override Staff.SustainPedal.before-line-breaking = #(lambda (grob)

  (if (eq? addGap #t)
      (begin
      (set! addGap #f)
        (if (not (string=? currPed "sustain"))
          (ly:grob-set-property! grob 'stencil
            (grob-interpret-markup grob #{ \markup \concat { \medium
\fontsize #-2 "Ped." \draw-line #'(0 . 4) } #} ))))

      (begin
        (set! addGap #t)
        (ly:grob-set-property! grob 'stencil
          (grob-interpret-markup grob #{ \markup  { \medium \fontsize #-2
"Ped." } #} ))
        (set! currPed "sustain"))))

  \override Staff.SostenutoPedal.before-line-breaking = #(lambda (grob)
  (if (eq? addGap #t)
      (begin
      (set! addGap #f)
        (if (not (string=? currPed "sostenuto"))
          (ly:grob-set-property! grob 'stencil
            (grob-interpret-markup grob #{ \markup \concat { \medium
\fontsize #-2 "S.Ped." \draw-line #'(0 . 4) } #} ))))
      (begin
        (set! addGap #t)
        (ly:grob-set-property! grob 'stencil
          (grob-interpret-markup grob #{ \markup  { \medium \fontsize #-2
"S.Ped." } #} ))
        (set! currPed "sostenuto"))))


  c'4\sustainOn c' c'\sostenutoOn c'\sustainOff\sostenutoOff r1\break

  c'4\sostenutoOn c' c'\sustainOn c'\sustainOff\sostenutoOff r1\break

  %WRONG
  c'4\sostenutoOn c'\sostenutoOff c'\sustainOn c'\sustainOff r1\break

}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

http://lilybin.com/qxsz64/1

Unfortunately, it doesn't work on the last system: as you can see, an
erroneous gap is added on the last pedal.
It could work if we find a way to check if the pedal belongs to a
VerticalAxisGroup which has two pedals. In this case, a gap can be added to
the second pedal.

Any help is greatly appreciated!

Best,
P

Reply via email to