lilypond-user
[Top][All Lists]
Advanced

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

Re: SustainPedal on shifted notes (possible bug?)


From: paolo prete
Subject: Re: SustainPedal on shifted notes (possible bug?)
Date: Sun, 25 Mar 2018 00:15:43 +0100

Thanks Thomas and Kieran,
That work-around works perfectly, without uncommenting the "  %\override Dynamics.PianoPedalBracket #'shorten-pair = #'(0 . -1)  " line 
(then, there's no need of the trial-and-error method mentioned by Kieran).
I tested it on 2.21.0
I don't understand yet if the default behaviour should be reported as bug in the ml, though...




2018-03-24 22:38 GMT+01:00 Thomas Morley <address@hidden>:
2018-03-24 17:19 GMT+01:00 paolo prete <address@hidden>:
> Hello,
>
> as you can see from the below snippet, the bracket of the sustain pedal is
> not properly extended when the last note is shifted.
> Is this a bug? Is there a way to fix it or a work-around ?

Iiuc, the PianoPedalBracket is left/right bound by PaperColumns.
If you move NoteColumn, then you move it relative to it's PaperColumn,
but PaperColumn is _not_ changed.
Thus the PianoPedalBracket doesn't move along.
Not a bug but a consequencee of the current implementation.

Btw, this was changed between 2.14 and 2.16.
Most likely with
https://sourceforge.net/p/testlilyissues/issues/2153/

I did some more research/comparison with Hairpins, which may be
bounded by PaperColumns as well.
Obviously there is some more fine-grained hierarchy coded how to bound Hairpins.
Something like: DynamicText present? -> NoteColumn? ->PaperColumn
Nevertheless this does not explain the behaviour of the Hairpin in the
last Dynamics-context below.
Or probably I don't fully understand what's going.

Make that a 'likely' lol


The code prints a lot of info, visible in pdf/readable in terminal.
You may try to uncomment the commands in the first Dynamics-context,
might be a work-around.
How to do final adjustments Kieren already demonstrated by using 'shorten-pair.

Old syntax is used and some definitions added to make it work even with 2.14.

#(use-modules (ice-9 pretty-print))

#(define-public (grob::name grob)
  "Return the name of the grob @var{grob} as a symbol."
  (assq-ref (ly:grob-property grob 'meta) 'name))

#(define print-info
  (lambda (grob)
    (format #t "\ncurrent default-bounds:\n~y"
      (list
        (grob::name grob)
        (ly:spanner-bound grob LEFT)
        (ly:spanner-bound grob RIGHT)))))

#(define nc-bounds!
      (lambda (grob)
        (let*  ((left-b (ly:spanner-bound grob LEFT))
                (left-elts (ly:grob-object left-b 'elements))
                (left-elts-ls
                  (if (ly:grob-array? left-elts)
                      (ly:grob-array->list left-elts)
                      '()))
                (left-nc
                  (filter
                    (lambda (g)
                      (grob::has-interface g 'note-column-interface))
                    left-elts-ls))
                (right-b (ly:spanner-bound grob RIGHT))
                (right-elts (ly:grob-object right-b 'elements))
                (right-elts-ls
                  (if (ly:grob-array? right-elts)
                      (ly:grob-array->list right-elts)
                      '()))
                (right-nc
                  (filter
                    (lambda (g)
                      (grob::has-interface g 'note-column-interface))
                    right-elts-ls)))
        ;(print-info grob)
        (if (pair? left-nc) (ly:spanner-set-bound! grob LEFT (car left-nc)))
        (if (pair? right-nc) (ly:spanner-set-bound! grob RIGHT (car
right-nc))))))

\score {
  <<
    \new Staff \with { instrumentName = "Staff 1 " } {

      c'2\sustainOn
      f'
      \once \override Score.NoteColumn #'X-offset = 10
      c''\sustainOff
    }
    \new Staff \with { instrumentName = "Staff 2 " } {
      c'\<
      f'
      c''\mf
    }
    \new Staff \with { instrumentName = "Staff 3 " } {
      c'\<
      f'
      c''\!
    }
    \new Dynamics \with { instrumentName = "Dyn 1 " } {
      %\override Dynamics.PianoPedalBracket #'after-line-breaking = #nc-bounds!
      %\override Dynamics.PianoPedalBracket #'shorten-pair = #'(0 . -1)
      s\sustainOn
      s
      s\sustainOff
    }
    \new Dynamics \with { instrumentName = "Dyn 2 " } {
      s\<
      s
      s\mf
    }
    \new Dynamics \with { instrumentName = "Dyn 3 " } {
      s\<
      s
      s\!
    }
  >>

  \layout {
      \context {
        \Dynamics
        \consists "Instrument_name_engraver"
      \override VerticalAxisGroup #'nonstaff-nonstaff-spacing =
        #'((padding . 2))
      \override VerticalAxisGroup #'nonstaff-relatedstaff-spacing =
        #'((padding . 4))
        \override Hairpin #'after-line-breaking = #print-info
        \override PianoPedalBracket #'after-line-breaking = #print-info
      }
    \context {
      \Voice
      \override Hairpin #'after-line-breaking = #print-info
    }
    \context {
      \Staff
      \override PianoPedalBracket #'after-line-breaking = #print-info
    }
    \context {
      \Score
      timing = ##f
      pedalSustainStyle = #'mixed
      \override PaperColumn #'stencil = #ly:paper-column::print
    }
  }
}

Cheers,
  Harm


reply via email to

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