lilypond-user
[Top][All Lists]
Advanced

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

Re: tempo indication without parentheses


From: Valentin Petzel
Subject: Re: tempo indication without parentheses
Date: Sun, 18 Dec 2022 02:23:19 +0100

Hello Paul,

formatting of the Metronome Marks is done by a function taking the event and 
the context given by the context property metronomeMarkFormatter.

If we look into ly/engraver-init.ly we see the default behaviour:

metronomeMarkFormatter = #format-metronome-markup

The scheme function format-metronome-markup is defined in scm/translation-
functions.scm:

(define-public (format-metronome-markup event context)
  (let ((hide-note (ly:context-property context 'tempoHideNote #f))
        (text (ly:event-property event 'text))
        (dur (ly:event-property event 'tempo-unit))
        (count (ly:event-property event 'metronome-count)))
    (metronome-markup text dur count hide-note)))

where the scheme function metronome-markup is defined below:

(define (metronome-markup text dur 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)
                UP))
              #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
                               (format #f "~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)))))


By copying these and adapting them to your liking you can shape the formatting 
any way you want, such as
→ no parentheses
→ approx sign or other marks instead of =
→ Different order of text and metronome marking

Cheers,
Valentin

Am Samstag, 17. Dezember 2022, 19:18:17 CET schrieb Paul Scott:
> Tempo indications in some published music doesn't use parentheses, i.e.
> quarter = 120 rather than (quarter = 120).  I have my own code to do
> this but would like to know if I can get Lilypond to omit the
> parentheses in:
> 
> \version "2.24.0"
> 
>   \tempo 4 = 120
> 
> TIA,
> 
> Paul

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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