11

Here's a minimal example of the sort of result I want to produce in LilyPond. (This was produced in Finale.)

enter image description here

Notice that the crescendo-stop, f, and decrescendo-start align with a note in the bottom staff only and the decrescendo-stop and last p align with a note in the top staff only.

Here's the best approximation I can write in LilyPond with its output.

\version "2.20.0"
\language "english"

\new PianoStaff <<
    \new Staff {
        \clef "treble"
        \time 3/4
        \relative c'' {c4 \p \< c2 | c4 c2 \p}
    }
    \new Staff {
        \clef "bass"
        \relative c' {r4 r4 c4~ \f \> | c2 r4 \!}
    }
>>

enter image description here

Notice that each hairpin doesn't terminate at the dynamic marking in the other staff. I'm not surprised by that output, I just don't know how to get the output I want.

The example I'm giving here is just a toy to illustrate the type of problem I'm facing in many much more complex passages.

Is there a standard solution for connecting dynamics between staves in LilyPond?

1 Answer 1

9

I typically solve this problem by using a separate \new Dynamics entry. I find that this a) helps align the dynamics more easily with staff objects, and b) aligns the dynamics vertically as opposed to having them be various distances from the staff.

\version "2.20.0"
\language "english"

\new PianoStaff <<
    \new Staff {
        \clef "treble"
        \time 3/4
        \relative c'' {c4 c2 | c4 c2 }
    }
    \new Dynamics {
      s4\p s\< s\!\f\> |
      s s\p
    }
    \new Staff {
        \clef "bass"
        \relative c' {r4 r4 c4~ | c2 r4 }
    }
>>

This produces:

enter image description here

Obviously you can tweak horizontal spacing to lengthen some of these hairpins, etc.

3
  • This is exactly what I needed to know. Thank you!
    – Victor
    Commented Oct 24, 2021 at 23:49
  • 3
    \!\f is unnecessary; stating a new dynamic automatically closes an open hairpin Commented Oct 25, 2021 at 2:51
  • @ElementsinSpace Oh, wow; how did I never realize that? Thanks, those are spots that I always have to think through when inputting the code, so this will save me untold headaches moving forward!
    – Richard
    Commented Oct 25, 2021 at 10:45

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.