lilypond-user
[Top][All Lists]
Advanced

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

Re: Rehearsal marks and tempo markings


From: fremoin
Subject: Re: Rehearsal marks and tempo markings
Date: Fri, 24 Sep 2021 18:33:20 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

Thank you Jean !

Le 24/09/2021 à 15:03, Jean Abou Samra a écrit :
Le 23/09/2021 à 23:34, Jean Abou Samra a écrit :
Le 23/09/2021 à 00:47, Nuno Trocado a écrit :
Perhaps you want the tempo mark to start on
the first note rather than the time signature:
Not really... I'd like to have the tempo mark aligning to the time signature, but shifting a little horizontally if it collides with a rehearsal mark.

Here is my attempt at automating it.
[…]


Below is a simplified version, solving a few issues.

\version "2.22.1"

#(define (Fix_tempo_mark_collision_engraver context)
    (let ((tempo #f)
          (mark #f))
      (make-engraver
        (acknowledgers
          ((metronome-mark-interface engraver grob source-engraver)
             (set! tempo grob))
          ((mark-interface engraver grob source-engraver)
             (set! mark grob)))
        ((stop-translation-timestep engraver)
           (if (and tempo mark)
               (let* ((tempo-stencil (ly:grob-property tempo 'stencil))
                     (tempo-width (interval-length (ly:stencil-extent tempo-stencil X)))
                      (mark-stencil (ly:grob-property mark 'stencil))
                     (mark-width (interval-length (ly:stencil-extent mark-stencil X)))                      (mark-alignment (ly:grob-property mark 'self-alignment-X))
                      (padding (ly:grob-property tempo 'padding))
                     (mark-relative-end (/ mark-width (+ mark-width padding tempo-width)))
                      (mark-end-index (1- (* 2 mark-relative-end)))
                     (new-alignment (interval-index (cons -1 mark-end-index)
mark-alignment)))
                 (set! (ly:grob-property mark 'stencil)
                      (ly:stencil-stack mark-stencil X RIGHT tempo-stencil padding))
                 (set! (ly:grob-property mark 'self-alignment-X)
                       new-alignment)
                 (ly:grob-suicide! tempo)))
           (set! tempo #f)
           (set! mark #f)))))

\layout {
   \context {
     \Score
     \consists #Fix_tempo_mark_collision_engraver
     \override MetronomeMark.padding = 0.8 % adjust
   }
}

{
   \clef treble
   \mark \default
   \tempo 4 = 120
   \time 3/4
   \repeat unfold 3 c''4
   \mark \default
   \tempo \markup \column { "Going down" down down… }
   R2.*4
   \mark \default
   \tempo "Long tempo text"
   \compressMMRests R2.*5
}


Best,
Jean








reply via email to

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