Menu

#4756 Automatically shift dynamics horizontally?

Accepted
nobody
None
design
Enhancement
2016-02-16
2016-01-29
No

Urs Liska and Malte Meyn wrote :

The fact that dynamics are always aligned to their notes can cause
unnecessarily large distances between staves as you can for example see
in the attached image generated from the following code.

\version "2.19.35"

off = {
% uncomment either of the following lines
%  \once \override DynamicText.X-offset = -3
%  \once \override DynamicText.X-offset = -3.5
}

\score {
  \new PianoStaff <<
    \new Staff \relative c'' {
      <<
        {
          \voiceOne
          c2 2
        }
        \new Voice {
          \voiceTwo
          e,4 c \off g \sf g'
        }
      >>
    }
    \new Staff \relative g {
      \clef bass
      <<
        {
          \voiceOne
          g4 a8 b c4 b8 a
        }
        \new Voice {
          \voiceTwo
          c,1
        }
      >>
    }
  >>
}

In such situations one will usually shift the dynamics to the left, and
Lily will automatically use the space better. You can see that when you
uncomment one of the lines in \off.

Would there be a way to approach this problem automatically, presumably
controlled by a configuration variable?

Basically a DynamicText (would this be true for other grobs as well? I
can't think of any) would - after line breaking is finished - have to
determine if it is the lowest element in a staff, and then consider
moving left until it can be shifted upwards. Is this possible?

I think this is something that would greatly reduce the number of cases
where LilyPond produces ugly layout by default, so it should be worth
exploring.

-and-

In my opinion moving the sf to the left looks like the b of the left
hand has the accent. In this case I would prefer a positive shift (to
the right):

off = {
  \once \override DynamicText.X-offset = 0.3
}

So if it is possible at all to do this automatically one probably would
want to be able to write something like

\once \override DynamicText.auto-X-offset = #RIGHT
1 Attachments

Discussion

  • Phil Holmes

    Phil Holmes - 2016-02-16
    • status: New --> Accepted
     
  • Urs Liska

    Urs Liska - 2016-02-16

    There was a clarification by Thomas Weber: It is not relevant whether a given dynamic text is the lowest in a given system but what the vertical distance to the element on the next staff is.

    See attached output of this file:

    \version "2.19.37"
    <<
      {c'\f d'2 a4\f}
      {g''' f'' e' f'}
    >>
    

    It is clear that it is the left dynamic that should be shifted, although it's the right that is the lowest on the staff.

    So an approach shouldn't consider the absolute position of a dynamic text but rather the distance between the dynamics lower vertical skyline and the upper skyline of the highest item on the staff below the current one.

     

Log in to post a comment.