lilypond-user
[Top][All Lists]
Advanced

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

Re: A somewhat unusual custom dynamic


From: Aaron Hill
Subject: Re: A somewhat unusual custom dynamic
Date: Sun, 04 Oct 2020 05:40:47 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-10-04 1:54 am, Andrew Bernard wrote:
Here's a custom dynamic I need (the usual New Complexity complications...):

pptopppdashText = \markup {
  \line {  pp \normal-text > ppp―  }
}
pptopppdash =
\tweak DynamicText.self-alignment-X #LEFT
#(make-dynamic-script pptopppdashText)

The greater than sign is my naive attempt to include a hairpin. The
question is, how could one put a 'proper' hairpin, with a view to
being able to make it longer?

Here's a way to do hairpins in markup:

%%%%
\version "2.20.0"

#(define CRESC RIGHT)
#(define DECRESC LEFT)

#(define-markup-command
  (hairpin layout props grow-direction)
  (number?)
  #:properties ((circled-tip #f)
                (height 2/3)
                (width 2)
                (thickness 1))

  (define (layout-property prop) (ly:output-def-lookup layout prop))
  (let ((line-thickness (layout-property 'line-thickness))
        (staff-space (layout-property 'staff-space)))
    (set! height (* height staff-space))
    (set! width (* width staff-space))
    (set! thickness (* thickness line-thickness)))

  (let ((tip-direction (- grow-direction))
        (radius (* height 0.525))
        (sten empty-stencil))
    (if circled-tip (set! width (- width (* 2 radius))))
    (set! sten
      (make-connected-path-stencil
        `((,(* tip-direction width) ,height)
          (0 ,(* 2 height)))
        thickness 1 1 #f #f))
    (if circled-tip
      (set! sten
        (ly:stencil-combine-at-edge
          sten X tip-direction
          (ly:stencil-translate-axis
            (make-circle-stencil radius thickness #f)
            height Y)
          (- thickness))))
    sten))

"mp<f>opp" =
\tweak self-alignment-X #LEFT
#(make-dynamic-script #{
  \markup \dynamic \override #'(width . 3) {
    mp \hairpin #CRESC
    f \override #'(circled-tip . #t)
      \hairpin #DECRESC
    pp
  } #})

{ b'2( \"mp<f>opp" c''16 b' a' b' a'4) }
%%%%


-- Aaron Hill

Attachment: hairpin-markup.cropped.png
Description: PNG image


reply via email to

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