Jump to content

Parenthesize crescendo and decrescendo spanners

From LilyPond wiki

Parenthesize crescendo and decrescendo spanners.

\version "2.24.0"

%% http://lsr.di.unimi.it/LSR/Item?id=1097
%% => http://lilypond-french-users.1298960.n2.nabble.com/cresc-entre-parentheses-td7587993.html 

% Version "2.19" and higher: dam = #(define-event-function () () etc.

\paper { tagline = ##f }

parC = #(define-event-function () ()
    #{  
      \tweak bound-details.left.text \markup\concat { \lower #.1 "(" "cresc." }
      \tweak bound-details.left.attach-dir #-2
      \tweak bound-details.right-broken.text ##f
      \tweak bound-details.left-broken.text ##f
      \tweak bound-details.right.text \markup\lower #.5 " )"
      \tweak bound-details.right.attach-dir # .5
      \cresc
    #})

parD = #(define-event-function () ()
    #{  
      \tweak bound-details.left.text \markup\concat { \lower #.1 "(" "decresc." }
      \tweak bound-details.left.attach-dir #-2
      \tweak bound-details.right-broken.text ##f
      \tweak bound-details.left-broken.text ##f
      \tweak bound-details.right.text \markup\lower #.5 " )"
      \tweak bound-details.right.attach-dir #.5
      \decresc
    #})

%% Test:
{ c'1*10 \cresc \break s1*5 c'1\! c'1*5 \decresc \break s1*10 c'1\! \bar "." }
{ c'1*10 \parC \break s1*5 c'1\! c'1*5 \parD \break s1*10 c'1\! \bar "." }