[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adjusting stem length in metronome mark?

From: Aaron Hill
Subject: Re: adjusting stem length in metronome mark?
Date: Sun, 12 Dec 2021 04:53:05 -0800
User-agent: Roundcube Webmail/1.4.9

On 2021-12-12 1:53 am, Josiah Boothby wrote:
I used to know how to do this, I think, 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
    \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 =
 (length) (number?)
 (define (fixup arg)
   ((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))
                (ly:duration-log dur)
                (ly:duration-dot-count dur)
         (count-markup (cond ((number? count)
                              (if (> count 0)
                                   (number->string count))
                             ((pair? count)
                              ;; Thin Spaces U+2009 & En-dash U+2013
(ly:format "~a – ~a" (car count) (cdr count))))
                             (else #f)))
         (note-markup (if (and (not hide-note) count-markup)
                           (make-general-align-markup Y DOWN note-mark)
                           (make-simple-markup " = ")
(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 " ("))
(list (make-simple-markup ")"))))))
            (make-line-markup (list text-markup)))
        (if note-markup
            (make-line-markup (list (make-concat-markup note-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 {
    metronomeMarkFormatter = #format-custom-metronome-markup

  \once \set Score.tempoStemLength = #0.6
  \tempo 4 = 60
  b'2 2

-- Aaron Hill

reply via email to

[Prev in Thread] Current Thread [Next in Thread]