Sustain pedal cautionary after line break: Difference between revisions
Appearance
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
m New category |
||
| (One intermediate revision by the same user not shown) | |||
| Line 70: | Line 70: | ||
[[Category:Breaks]] | [[Category:Breaks]] | ||
[[Category:Workaround]] | [[Category:Workaround]] | ||
[[Category:Snippet]] | |||
Latest revision as of 23:33, 21 November 2025
Add a cautionary indication showing that the sustain pedal should remain pressed after a line break.
Syntax is [music]\sustainSpanOn[music]\sustainSpanOff.
This workaround uses TextSpanner instead of SustainPedal/PianoPedalBracket.
\version "2.24"
%% http://lsr.di.unimi.it/LSR/Item?id=1023
%% Credits PPS => http://lilypond.1069038.n5.nabble.com/Sustain-pedal-cautionary-after-line-break-td186551.html
\paper { tagline = ##f }
%%%% Snippet start here:
%% Cautionary pedal mark after a line break:
cautionPed = \markup {
\normal-text
\with-dimensions #'(0 . 6) #'(0 . 1.8)
\concat {
"("
\musicglyph "pedal.Ped"
\musicglyph "pedal.."
")"
}
}
ped = \markup {
\concat {
\musicglyph "pedal.Ped"
\musicglyph "pedal.."
\hspace #0.95
}
}
%% Span:
sustainSpanOn =
#(define-event-function ()()
#{
\tweak bound-details
#`((left . ((Y . 0)
(padding . -1.7)
(attach-dir . ,LEFT)
(stencil-align-dir-y . -1)
(text . ,ped)))
(left-broken . ((attach-dir . ,RIGHT)
(text . ,cautionPed)
(padding . 0)))
(right . ((Y . 0)
(attach-dir . ,LEFT)
(text . ,(markup #:draw-line (cons 0 1)))))
(right-broken . ((padding . -0.2)
(text . #f))))
\tweak padding #1.2
\tweak direction #-1
\tweak style #'line
\startTextSpan
#})
sustainSpanOff = \stopTextSpan
%% Test:
\relative c'' {
c1\sustainSpanOn
\break
c1 c1\sustainSpanOff
}