1 %% Do not edit this file; it is auto-generated from input/new
2 %% This file is in the public domain.
5 lsrtags = "expressive-marks,text,tweaks-and-overrides"
7 Using Scheme code to override the stencil for @code{MetronomeMark}
8 objects, this example allows the creation of metronome marks which include
9 text directions. The function @code{\tempoChangeMarkup} is called with three
10 strings: the text label, note duration, and beats per minute. To print the
11 new metronome mark, this is followed by the standard @code{\tempo} command.
13 doctitle = "Adding text indications to metronome marks"
16 % Thanks to Alexander Kobel for this snippet
18 tempoMarkLabelSize = #0
19 tempoMarkNoteSize = #-6
21 #(define (tempoChangeMarkupFactory grob label noteValue tempo)
24 (ly:grob-alist-chain grob (ly:output-def-lookup (ly:grob-layout grob) 'text-font-defaults))
26 #:fontsize tempoMarkLabelSize #:italic #:concat (label (if (string-null? label) "(" " (" ))
28 #:fontsize tempoMarkNoteSize #:general-align Y DOWN #:note noteValue UP
29 #:fontsize tempoMarkLabelSize #:italic #:concat( "= " tempo ")" )
33 #(define (tempoChangeStencil label noteValue tempo)
35 (tempoChangeMarkupFactory grob label noteValue tempo)
38 tempoChangeMarkup = #(define-music-function (parser location label noteValue tempo) (string? string? string?)
40 \once \override Score.MetronomeMark #'stencil = #(tempoChangeStencil $label $noteValue $tempo)
46 % initialize the override
47 \tempoChangeMarkup #"Moderato" #"4" #"63"
54 \tempoChangeMarkup #"presto" #"2." #"90"
57 e \tempoChangeMarkup #"handling collision with RehearsalMark" #"4" #"120" \tempo 4 = 120 c