On 2021-12-12 1:53 am, Josiah Boothby wrote:
I used to know how to do this, I think, but...how do I adjust the stem
length in a metronome mark? Seems like I should be able to do something
like
\override MetronomeMark.stem-length = xyz
but that *specifically* doesn't appear to be available.
Something involving .add-stem-length perhaps?
Stem length for MetronomeMark is hard-coded. See metronome-markup
within translation-functions.scm.
Depending on your needs, you could simply provide your own markup rather
than use the built-in procedure.
%%%%
\version "2.22.0"
{
\once \set Score.tempoHideNote = ##t
\tempo
\markup \concat {
\general-align #Y #DOWN
\smaller \note { 4 } #0.6
\normal-text " = 60"
}
4 = 60
b'2 2
}
%%%%
If you want to avoid duplicating some of the effort, you could do
something like this to patch the markup that gets generated normally:
%%%%
\version "2.22.0"
metronomeMarkStemLength =
#(define-music-function
(length) (number?)
(define (fixup arg)
(cond
((and (pair? arg) (eq? note-by-number-markup (car arg)))
(begin (list-set! arg 3 length) arg))
((list? arg) (map fixup arg))
(else arg)))
(define (proc grob grob-origin context)
(ly:grob-set-property! grob 'text
(fixup (ly:grob-property grob 'text))))
#{ \applyOutput Score.MetronomeMark #proc #})
{
\metronomeMarkStemLength #0.6
\tempo 4 = 60
b'2 2
}
%%%%
Alternately, you could replace the built-in code with something that can
check a new context property:
%%%%
\version "2.22.0"
#(define (custom-metronome-markup text dur len count hide-note)
(let* ((note-mark
(if (and (not hide-note) (ly:duration? dur))
(make-smaller-markup
(make-note-by-number-markup
(ly:duration-log dur)
(ly:duration-dot-count dur)
len))
#f))
(count-markup (cond ((number? count)
(if (> count 0)
(make-simple-markup
(number->string count))
#f))
((pair? count)
;; Thin Spaces U+2009 & En-dash U+2013
(make-simple-markup
(ly:format "~a – ~a" (car count) (cdr
count))))
(else #f)))
(note-markup (if (and (not hide-note) count-markup)
(list
(make-general-align-markup Y DOWN note-mark)
(make-simple-markup " = ")
count-markup)
#f))
(text-markup (if (not (null? text)) (make-bold-markup text)
#f)))
(if text-markup
(if (and note-markup (not hide-note))
(make-line-markup (list (make-concat-markup
(append (list text-markup
(make-simple-markup "
("))
note-markup
(list (make-simple-markup
")"))))))
(make-line-markup (list text-markup)))
(if note-markup
(make-line-markup (list (make-concat-markup note-markup)))
(make-null-markup)))))
#(set-object-property! 'tempoStemLength 'translation-type? number?)
#(define (format-custom-metronome-markup event context)
(let ((hide-note (ly:context-property context 'tempoHideNote #f))
(len (ly:context-property context 'tempoStemLength 1))
(text (ly:event-property event 'text))
(dur (ly:event-property event 'tempo-unit))
(count (ly:event-property event 'metronome-count)))
(custom-metronome-markup text dur len count hide-note)))
\layout {
\context {
\Score
metronomeMarkFormatter = #format-custom-metronome-markup
}
}
{
\once \set Score.tempoStemLength = #0.6
\tempo 4 = 60
b'2 2
}
%%%%
-- Aaron Hill