3 lsrtags = "expressive-marks,text,tweaks-and-overrides"
5 Using Scheme code to override the stencil for @code{MetronomeMark}
6 objects, this example allows the creation of metronome marks which include
7 text directions. The function @code{\tempoChangeMarkup} is called with three
8 strings: the text label, note duration, and beats per minute. To print the
9 new metronome mark, this is followed by the standard @code{\tempo} command.
11 doctitle = "Adding text indications to metronome marks"
14 % Thanks to Alexander Kobel for this snippet
16 tempoMarkLabelSize = #0
17 tempoMarkNoteSize = #-6
19 #(define (tempoChangeMarkupFactory grob label noteValue tempo)
22 (ly:grob-alist-chain grob (ly:output-def-lookup (ly:grob-layout grob) 'text-font-defaults))
24 #:fontsize tempoMarkLabelSize #:italic #:concat (label (if (string-null? label) "(" " (" ))
26 #:fontsize tempoMarkNoteSize #:general-align Y DOWN #:note noteValue UP
27 #:fontsize tempoMarkLabelSize #:italic #:concat( "= " tempo ")" )
31 #(define (tempoChangeStencil label noteValue tempo)
33 (tempoChangeMarkupFactory grob label noteValue tempo)
36 tempoChangeMarkup = #(define-music-function (parser location label noteValue tempo) (string? string? string?)
38 \once \override Score.MetronomeMark #'stencil = #(tempoChangeStencil $label $noteValue $tempo)
44 % initialize the override
45 \tempoChangeMarkup #"Moderato" #"4" #"63"
52 \tempoChangeMarkup #"presto" #"2." #"90"
55 e \tempoChangeMarkup #"handling collision with RehearsalMark" #"4" #"120" \tempo 4 = 120 c