lilypond-user
[Top][All Lists]
Advanced

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

Re: Sustain pedal cautionary after line break


From: Thomas Morley
Subject: Re: Sustain pedal cautionary after line break
Date: Wed, 3 Feb 2016 00:17:50 +0100

2016-02-02 16:00 GMT+01:00 Pierre Perol-Schneider
<address@hidden>:
> Hi Kieren, hi Caio et All,
>
> Here's a trial to find a workaround avoiding the use of a TextSpanner:
>
> \version "2.18.2"
>
> \relative c'' {
>   \set Staff.pedalSustainStyle = #'mixed
>   \once\override Staff.SustainPedalLineSpanner.stencil =
>      #ly:line-spanner::print
>   \once\override Staff.SustainPedalLineSpanner.left-bound-info =
>      #ly:line-spanner::calc-left-bound-info-and-text
>   \once\override Staff.SustainPedalLineSpanner.right-bound-info =
>      #ly:line-spanner::calc-right-bound-info
>   \once\override Staff.SustainPedalLineSpanner.staff-padding = #3
>   \once\override Staff.SustainPedalLineSpanner.bound-details =
>      #`((right (Y . 0)(attach-dir . -1))
>         (left (attach-dir . 2)(Y . 0))
>         (left-broken
>          (Y . 0)
>          (attach-dir . 1)
>          (text . ,
>            #{
>              \markup
>              \normal-text
>              \whiteout
>              \pad-markup #.1
>              \concat { "(" \musicglyph #"pedal.Ped" ".) " }
>            #})))
>
>   c1 c\sustainOn \break c c\sustainOff c
> }
>
> However, I tried to make a useful music function with it without success:
>
> \version "2.18.2"
>
> %% Cautionary pedal mark after a line break:
> cautionPed = \markup {
>   \normal-text
>   \whiteout
>   \pad-markup #.1
>   \concat { "(" \musicglyph #"pedal.Ped" ".) " }
> }
>
> %% Span:
> sustainPedalSpan =
> #(define-music-function (parser location music) (ly:music?)
>    (let ((elts (extract-named-music music '(NoteEvent EventChord))))
>      (if (pair? elts)
>          (let ((first-element (first elts))
>                (last-element (last elts)))

It's 'articulations not 'articulation.

>            (set! (ly:music-property first-element 'articulation)
>                  (cons (make-music 'SustainEvent 'span-direction -1)
>                        (ly:music-property first-element 'articulation)))
>            (set! (ly:music-property last-element 'articulation)
>                  (cons (make-music 'SustainEvent 'span-direction 1)
>                        (ly:music-property last-element 'articulation))))))
>    #{

To make it work with recent devel versions you need to add
\once\override Staff.SustainPedalLineSpanner.layer = #2 %% every value
>1 will do

No idea why.
'layer is unset for SustainPedalLineSpanner in 2.18.2 _and_ 2.19.35

>       \set Staff.pedalSustainStyle = #'mixed
>       \once\override Staff.SustainPedalLineSpanner.stencil =
>          #ly:line-spanner::print
>       \once\override Staff.SustainPedalLineSpanner.left-bound-info =
>          #ly:line-spanner::calc-left-bound-info-and-text
>       \once\override Staff.SustainPedalLineSpanner.right-bound-info =
>          #ly:line-spanner::calc-right-bound-info
>       \once\override Staff.SustainPedalLineSpanner.staff-padding = #3
>       \once\override Staff.SustainPedalLineSpanner.bound-details =
>          #`((right (Y . 0)(attach-dir . -1))
>             (left (attach-dir . 2)(Y . 0))
>             (left-broken
>              (Y . 0)
>              (attach-dir . 1)
>              (text . ,cautionPed)))
>       $music
>       \unset Staff.pedalSustainStyle
>    #})
>
> %% Syntax: \sustainPedSpan { notes }
>
> %% Test:
> \relative c'' {
>   c1 \sustainPedalSpan { c \break c c } c
> }
>
> Any idea what's wrong?
>
> Cheers,
> Pierre

Cheers,
  Harm



reply via email to

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