3

I tried

\version "2.22.1"
\language "english"

{ 
  \dynamicUp
  \once \override DynamicLineSpanner.staff-padding = #0
  \once \override DynamicLineSpanner.Y-offset = -3
  b'\f
}

and

\version "2.22.1"
\language "english"

{ 
  \dynamicUp
  \once \override DynamicLineSpanner.staff-padding = #0
  \once \override DynamicLineSpanner.Y-offset = -4
  b'\f
}

But that doesn't seem to suffice and the dynamic just skips to under the staff above a certain threshold.

Is there a way to allow dynamics to touch the staff, like in the following example?

Dynamic partly within the staff

Ideally this would be obtained with all other grobs adjusting to this change, so if I'm not mistaken extra-offset is not a solution.

This is a wider view of the traditional engraving:

Traditional engraving

And this is the (less satisfying) best approximation I've managed on Lilypond:

Lilypond approximation: Not as satisfying

2
  • Why do you want the dynamic mark inside the staff? Commented Mar 22, 2022 at 17:15
  • @ElementsinSpace The same reason traditional engravers use that: space economy and sometimes esthetics (e.g. to avoid a single dynamic marking in a system create an unseemly gap between the staff and some other outside-staff layer like a tempo marking or some other text script). Added more screenshots Commented Mar 22, 2022 at 17:24

1 Answer 1

4

The way to disable staff collision avoidance for the dynamic marking (or any outside-staff object) isn't by turning the staff-padding of the DynamicLineSpanner to #0 but its outside-staff-priority to ##f.

I deduced that from the LilyPond Learning Manual: 4.4.3 Outside-staff objects, particularly from the part under "The outside-staff-priority property" where they talk about slurs and articulations.

The dynamic will then be centered in the staff. The Y-offset can then be modified with an \override and the X-offset with a \tweak (per LilyPond Notation Reference: 4.6.2 Changing spacing) like so:

\version "2.22.1"
\language "english"

{ 
  \dynamicUp
  \once \override DynamicLineSpanner.outside-staff-priority = ##f
  \once \override DynamicLineSpanner.Y-offset = #2
  b'-\tweak X-offset #-0.75 \f
}

The result

1
  • Yes. Generally by having a value for outside-staff-priority gives the grob the outside-staff-interface, thus Lilypond will not allow it to intersect with the staff.
    – Lazy
    Commented Mar 23, 2022 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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