Jump to content

Dynamics spanner with custom text (2): Difference between revisions

From LilyPond wiki
m Lemzwerg moved page Dynamics text spanner postfix to Dynamics spanner with custom text (2) without leaving a redirect
remove this from the official documentation since there is a very similar snippet
Line 1: Line 1:
Custom text spanners can be defined and used with hairpin and text crescendos. <code>\&lt;</code> and <code>\&gt;</code> produce hairpins by default, <code>\cresc</code> etc. produce text spanners by default.
Custom text spanners can be defined and used with hairpin and text crescendos. <code>\<</code> and <code>\></code> produce hairpins by default, <code>\cresc</code>, etc., produce text spanners by default.


<lilypond version="2.24">
<lilypond version="2.24">
Line 20: Line 20:
[[Category:Expressive marks]]
[[Category:Expressive marks]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]
[[Category:Snippet]]

Revision as of 14:10, 3 December 2025

Custom text spanners can be defined and used with hairpin and text crescendos. \< and \> produce hairpins by default, \cresc, etc., produce text spanners by default.

\version "2.24"

% Some sample text dynamic spanners, to be used as postfix operators
crpoco =
#(make-music 'CrescendoEvent
             'span-direction START
             'span-type 'text
             'span-text "cresc. poco a poco")

\relative c' {
  c4\cresc d4 e4 f4 |
  g4 a4\! b4\crpoco c4 |
  c4 d4 e4 f4 |
  g4 a4\! b4\< c4 |
  g4\dim a4 b4\decresc c4\!
}