Jump to content

Dynamics spanner with custom text: Difference between revisions

From LilyPond wiki
No edit summary
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 21: Line 21:
   c4 c4 c4 c4 |
   c4 c4 c4 c4 |
   c4-\mydecresc "custom decresc" c4 c4 c4 |
   c4-\mydecresc "custom decresc" c4 c4 c4 |
  c4 c4 c4 c4 |
   c4 c4\! c4 c4
   c4 c4\! c4 c4
}
}
Line 27: Line 28:
[[Category:Expressive marks]]
[[Category:Expressive marks]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 12:20, 9 December 2025

Postfix functions for custom crescendo text spanners. The spanners should start on the first note of the measure. One has to use -\mycresc, otherwise the spanner start will rather be assigned to the next note.

\version "2.24"

% Two functions for (de)crescendo spanners where you can explicitly
% give the spanner text.
mycresc =
#(define-music-function (mymarkup) (markup?)
   (make-music 'CrescendoEvent
               'span-direction START
               'span-type 'text
               'span-text mymarkup))
mydecresc =
#(define-music-function (mymarkup) (markup?)
   (make-music 'DecrescendoEvent
               'span-direction START
               'span-type 'text
               'span-text mymarkup))

\relative c' {
  c4-\mycresc "custom cresc" c4 c4 c4 |
  c4 c4 c4 c4 |
  c4-\mydecresc "custom decresc" c4 c4 c4 |
  c4 c4 c4 c4 |
  c4 c4\! c4 c4
}