Jump to content

Piano template with centered dynamics: Difference between revisions

From LilyPond wiki
No edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Many piano scores have the dynamics centered between the two staves. This snippet demonstrates how this was achieved with older versions of LilyPond; the Dynamics context is now included by default (starting with LilyPond 2.13.29), and does not require to be defined manually.
Many piano scores have the dynamics centered between the two staves. Using the <code>Dynamics</code> context this is quite easy to achieve.


<lilypond version="2.24">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=357
global = {
global = {
   \key c \major
   \key c \major
Line 27: Line 25:
}
}


\score {
\new PianoStaff = "PianoStaff_pf" <<
  \new PianoStaff = "PianoStaff_pf" <<
  \new Staff = "right" << \global \upper >>
    \new Staff = "Staff_pfUpper" << \global \upper >>
  \new Dynamics = "dynamics" \dynamics
    \new Dynamics = "Dynamics_pf" \dynamics
  \new Staff = "left" << \global \lower >>
    \new Staff = "Staff_pfLower" << \global \lower >>
  \new Dynamics = "pedal" \pedal
    \new Dynamics = "pedal" \pedal
>>
  >>
  \layout { }
}
 
\score {
  \new PianoStaff = "PianoStaff_pf" <<
    \new Staff = "Staff_pfUpper" << \global \upper \dynamics \pedal >>
    \new Staff = "Staff_pfLower" << \global \lower \dynamics \pedal >>
  >>
  \midi { }
}
</lilypond>
</lilypond>


[[Category:Expressive marks]]
[[Category:Keyboards]]
[[Category:Really simple]]
[[Category:Template]]
[[Category:Template]]
[[Category:Keyboards]]
[[Category:Snippet]]
[[Category:Expressive marks]]
[[Category:Workaround]][[Category:Snippet]]

Latest revision as of 17:41, 12 December 2025

Many piano scores have the dynamics centered between the two staves. Using the Dynamics context this is quite easy to achieve.

\version "2.24"

global = {
  \key c \major
  \time 4/4
}

upper = \relative c'' {
  \clef treble
  a4 b c d
}

lower = \relative c {
  \clef bass
  a2 c
}

dynamics = {
  s2\fff\> s4 s\!\pp
}

pedal = {
  s2\sustainOn s\sustainOff
}

\new PianoStaff = "PianoStaff_pf" <<
  \new Staff = "right" << \global \upper >>
  \new Dynamics = "dynamics" \dynamics
  \new Staff = "left" << \global \lower >>
  \new Dynamics = "pedal" \pedal
>>