1

I am in the process of engraving a piano sheet, and I wrote a custom dynamic mark with the look of which I am very happy, but the behavior, not totally. It is the following :

mff = \tweak DynamicText.self-alignment-X #LEFT
    #(make-dynamic-script 
    (markup 
        #:dynamic "mf"
        #:normal-text #:italic #:teeny "2ème fois"
        #:dynamic "f"))

When used, it looks like :

enter image description here

When not used, it looks like :

enter image description here

I am happy with the mark beginning below the note to which it is attached (as opposed to centered below that note); but I would like that it doesn't postpone the next note until the mark is entirely written. Ideally, it would affect the bar width only if the line marking the end of the bar risks to cut the mark.

I can't find what I'm looking for in the documentation.

In case there is any need for it, here is my code for the music :

%%%%%%%%%%
%% VERSION
%%%%%%%%%%

\version "2.20.0"

\paper {
    #(include-special-characters)
}


%%%%%%%%%%%
%% PIANO UP
%%%%%%%%%%%

mff = \tweak DynamicText.self-alignment-X #LEFT
    #(make-dynamic-script 
    (markup 
        #:dynamic "mf"
        #:normal-text #:italic #:teeny "2ème fois"
        #:dynamic "f"))

pianoUpper = \relative c' {
    \override DynamicLineSpanner.staff-padding = #3
    \clef "treble"
    \key d \minor

    \time 4/4

    <\tweak font-size #-3 a f'>4 \f <\tweak font-size #-3 c g'> <f a> <d bes'> | 
    <f a>2 <e g> |
    f2. r4 \bar "||"
    <f a> \mf \< <f a> <f a> <f a>8 <a c> |
    <a c>4. <g bes>8 <f a>4 f \! |

    <f a> <f a>8 <e g> <f a>4 <f a>8 <a c> |
    <a c>4. \> <g bes>8 <f a>4 r \! |
    <f a> \p \< <f a> <f a> <f a>8 <a c> |
    <a c>4. <g bes>8 <f a>4 f \! |
    <f a> <f a>8 <e g> <f a>4 <f a>8 <a c> |

    <a c>4. \> <g bes>8 <f a>4 r \! |
    \repeat volta 2 {
        c'2\( d8 c bes a |
        bes2 c8 bes a g |
        a2 bes8 a g f |
        g4.\) g8 c,2 \> |

        <\tweak font-size #-3 a f'>4 \< <\tweak font-size #-3 c g'> <f a> <d bes'> |
    }
    \alternative{ 
        {<f a>2 \> <e g>4 r \! |}
        {<c a'>2\( <bes g'>\) |
        <a f'>2. r4 \bar "|."}
    }
}


%%%%%%%%%%%%
%% PIANO LOW
%%%%%%%%%%%%

pianoLower = \relative c {
    \clef "bass"
    \key d \minor

    f4 c f bes, |
    c2 <c, c'> |
    <f f'>4 c' f, r |
    f' <a c> f <a c> |
    c, <e bes' c> f <a c> | 

    f <a c> f <a c> |
    c, <e bes' c> <f a c> r |
    f <a c> f <a c> |
    c, <e bes' c> f <a c> | 
    f <a c> f <a c> |

    c, <e bes' c> <f a c> r |
    f <a c> d, <fis c'> |
    g, <g' bes d> c, <e bes' c> |
    f <a c> d, <f bes> |
    c <e bes c> c <e g> |

    f c f bes, |
    c2 c4 c |
    c2 <c, c'> |
    <f f'>4 c' f, r |
}


%%%%%%%%
%% SCORE
%%%%%%%%


\score {
    <<
        \new PianoStaff <<
            \new Staff = "upper" \pianoUpper
            \new Staff = "lower" \pianoLower
        >>
    >>
}
  • I think there's some commands to override the "self-alignment" and assign an absolute position. I know it's tough to find info in the LilyPond documentation but maybe someone will find that before I do. – Carl Witthoft Apr 29 at 15:25
1

You can explicitly set the dimension of your markup using \with-dimensions (or in this case, as we are already within the definition of a Scheme macro, #:with-dimensions. This macro takes two Scheme pairs that define the left and right as well as the bottom and top edge of the markup. The markup itself can be bigger than the box you define with these measures, and when typeset the bounding of this box will be used. (See the documentation for more information.)

Because \with-dimensions only accepts one argument, you need to additional wrap your markup in another \line macro. So, you could e.g. write your macro like this:

mff = \tweak DynamicText.self-alignment-X #LEFT
    #(make-dynamic-script 
    (markup #:with-dimensions '(0 . 5) '(-3 . 3) #:line 
       (#:dynamic "mf"
        #:normal-text #:italic #:teeny "2ème fois"
        #:dynamic "f")))

Result:

enter image description here

There are also several other ways of tweaking the dimensions and alignment of dynamics, some of which are explained in this snippet.

| improve this answer | |
3

If you use this definition that looks just like a dynamic mark,

mff= _ \markup { \dynamic mf \italic \teeny "2ème fois" \dynamic f }

then the result is this:

enter image description here

| improve this answer | |
  • "The interest of using make-dynamic-script instead of an ordinary markup is ensuring the vertical alignment of markup objects." is what I can read on the documentation : lilypond.org/doc/v2.18/Documentation/notation/… but your solution still seems to work in my specific case. Should I expect that sometimes it doesn't ? Like in other cases when I want a long custom dynamic mark and it might not vertically allign ? – JambonSama Apr 29 at 21:43
  • After tests, I noticed that indeed, there are cases in which the vertical alignment is not maintained. I have already upvoted the answer, because it solved my issue in that case (even if only by luck). – JambonSama Jun 16 at 21:54
1

I know nothing of the intricacies of LilyPond. But this is normally notated simply and sufficiently as mf-f. Would suggesting you notate it that way be considered a solution?

| improve this answer | |
  • Good point. I like K.I.S.S. solutions. – Carl Witthoft Apr 30 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.