lilypond-user
[Top][All Lists]
Advanced

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

Re: piano pedals


From: David Nalesnik
Subject: Re: piano pedals
Date: Thu, 13 Sep 2012 15:07:49 -0500

Hi James,

On Thu, Sep 13, 2012 at 1:17 PM, james <address@hidden> wrote:
> I still haven't figured this out, so I'm putting out another request. Is 
> possible to get piano pedals that have the word "Ped". and broken-line 
> spanner, and the asterisk at the end?
>

I didn't find any easy way to do this, so I ended up having to
manipulate the "mixed" pedal bracket style (text plus extender
bracket) and adding the asterisk at the end.

You can control the parameters of the dashed line by fiddling with the
numbers in the line beginning

(dashed
  (ly:make-stencil

(I tried to make it look somewhat like your attached image.)

There will be a problem here when the pedalling is broken across a
line.  (The asterisk will be duplicated.)  This is fixable, but I'd
like to know first that there isn't some simple solution to your
problem before I make this even more arcane :)

Hope you find this helpful--
-David

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.16.0"

% include the following function in your file
#(define custom-stencil
  (lambda (grob)
    (let* ((stil (ly:piano-pedal-bracket::print grob))
           (stil-ext-X (ly:stencil-extent stil X))
           (stil-ext-Y (ly:stencil-extent stil Y))
           (dx (interval-length stil-ext-X))
           (dx-adjusted (coord-translate stil-ext-X (cons 0 (- (car
stil-ext-X)))))
           (dy (interval-length stil-ext-Y))
           (stil-ext-Y (ly:stencil-extent stil Y))
           (dashed
             (ly:make-stencil
               `(dashed-line 0.1 0.5 3 ,dx ,dy 0) ; thickness on off dx dy phase
               dx-adjusted stil-ext-Y))
           (dashed (ly:stencil-translate-axis dashed (car stil-ext-X) X))
           (asterisk (grob-interpret-markup grob (markup #:musicglyph
"pedal.*")))
           (asterisk (ly:stencil-aligned-to asterisk Y CENTER)))

      (ly:stencil-combine-at-edge dashed X RIGHT asterisk 1))))

\new Staff {
  \relative c {
    \override Staff.PianoPedalBracket #'edge-height = #'(0.0 . 0.0)
    % the following controls the position of the pedal-off symbol
    \override Staff.PianoPedalBracket #'shorten-pair = #'(0 . 1)
    % this is how to call the dashed-line function
    \override Staff.PianoPedalBracket #'stencil = #custom-stencil
    % the following line is necessary since we need a bracket stencil
to work with
    \set Staff.pedalSustainStyle = #'mixed
    \clef bass
    <c e g>\sustainOn q q q
    q q q q\sustainOff
    q q q q\sustainOn
    q q q q
    q q q q
    q q q q\sustainOff
  }
}



reply via email to

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