lilypond-user
[Top][All Lists]
Advanced

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

Re: Pedal gradual release


From: Aaron Hill
Subject: Re: Pedal gradual release
Date: Sun, 20 Jan 2019 05:21:00 -0800
User-agent: Roundcube Webmail/1.3.8

On 2019-01-20 4:28 am, Aaron Hill wrote:
One option would be to exploit a Hairpin:

%%%%
sustainGradualRelease =
  -\tweak shorten-pair #'(0 . 1.35)
  -\tweak height #1
  -\tweak style #'dashed-line
  -\tweak self-alignment-Y #DOWN
  -\tweak to-barline ##f
  -\tweak stencil #(elbowed-hairpin '((0 . 0) (1 . 1)) #f)
  \<

sustainPedal = {
  s4\sustainOn s s\sustainGradualRelease s s s\!\sustainOff
}
%%%%

This is far from ideal, as a hairpin by default will attempt to align
to the right extent of the musical column (unless the column has a
rest, and then it aligns to the left).  The piano bracket aligns to
the left, so setting shorten-pair is needed to have the hairpin meet
the piano bracket.

This version calculates the correct width by pretending the hairpin is actually a piano pedal bracket and then customizing the stencil. It also responds to the grow-direction of the hairpin so you can use it for gradually pressing and releasing the sustain:

%%%%
sustainGradual =
  -\tweak edge-height #'(0 . 1)
  -\tweak self-alignment-Y #DOWN
  -\tweak style #'dashed-line
  -\tweak stencil #(lambda (grob)
    (let* ((sten (ly:piano-pedal-bracket::print grob))
           (xex (ly:stencil-extent sten X))
           (yex (ly:stencil-extent sten Y))
           (cresc? (eqv? (ly:grob-property grob 'grow-direction) LEFT)))
      (ly:line-interface::line grob
        (car xex) (if cresc? (car yex) (cdr yex))
        (cdr xex) (if cresc? (cdr yex) (car yex)))))
  \etc

sustainGradualOn = -\sustainGradual \<
sustainGradualOff = -\sustainGradual \>


sustainPedal = {
  s4\sustainOn s s\sustainGradualOff s s s\!\sustainOff
  s s\sustainOn\sustainGradualOn s s\! s s\sustainOff
}
%%%%

There is an annoying alignment issue with the end of the dashed line not meeting the piano pedal bracket. Still trying to track down the culprit. (I suspect the piano pedal bracket itself is the one that is not correct.)

-- Aaron Hill



reply via email to

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