Next: String quartet, Previous: Single staff, Up: Templates
Here is a simple piano staff.
\version "2.10.10"
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
\score {
\new PianoStaff <<
\set PianoStaff.instrumentName = "Piano "
\new Staff = "upper" \upper
\new Staff = "lower" \lower
>>
\layout { }
\midi { }
}
Here is a typical song format: one staff with the melody and lyrics, with piano accompaniment underneath.
\version "2.10.10"
melody = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
\score {
<<
\new Voice = "mel" {
\autoBeamOff
\melody
}
\new Lyrics \lyricsto mel \text
\new PianoStaff <<
\new Staff = "upper" \upper
\new Staff = "lower" \lower
>>
>>
\layout {
\context { \RemoveEmptyStaffContext }
}
\midi { }
}
Instead of having a full staff for the melody and lyrics, you can place the lyrics between the piano staff (and omit the separate melody staff).
\version "2.10.10"
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
text = \lyricmode {
Aaa Bee Cee Dee
}
\score {
\new GrandStaff <<
\new Staff = upper { \new Voice = "singer" \upper }
\new Lyrics \lyricsto "singer" \text
\new Staff = lower {
\clef bass
\lower
}
>>
\layout {
\context { \GrandStaff \accepts "Lyrics" }
\context { \Lyrics \consists "Bar_engraver" }
}
\midi { }
}
Many piano scores have the dynamics centered between the two staffs. This requires a bit of tweaking to implement, but since the template is right here, you don't have to do the tweaking yourself.
\version "2.10.10"
upper = \relative c'' {
\clef treble
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
dynamics = {
s2\fff\> s4
s\!\pp
}
pedal = {
s2\sustainDown s2\sustainUp
}
\score {
\new PianoStaff <<
\new Staff = "upper" \upper
\new Dynamics = "dynamics" \dynamics
\new Staff = "lower" <<
\clef bass
\lower
>>
\new Dynamics = "pedal" \pedal
>>
\layout {
\context {
\type "Engraver_group"
\name Dynamics
\alias Voice % So that \cresc works, for example.
\consists "Output_property_engraver"
\override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
pedalSustainStrings = #'("Ped." "*Ped." "*")
pedalUnaCordaStrings = #'("una corda" "" "tre corde")
\consists "Piano_pedal_engraver"
\consists "Script_engraver"
\consists "Dynamic_engraver"
\consists "Text_engraver"
\override TextScript #'font-size = #2
\override TextScript #'font-shape = #'italic
\override DynamicText #'extra-offset = #'(0 . 2.5)
\override Hairpin #'extra-offset = #'(0 . 2.5)
\consists "Skip_event_swallow_translator"
\consists "Axis_group_engraver"
}
\context {
\PianoStaff
\accepts Dynamics
\override VerticalAlignment #'forced-distance = #7
}
}
}
\score {
\new PianoStaff <<
\new Staff = "upper" << \upper \dynamics >>
\new Staff = "lower" << \lower \dynamics >>
\new Dynamics = "pedal" \pedal
>>
\midi {
\context {
\type "Performer_group"
\name Dynamics
\consists "Piano_pedal_performer"
}
\context {
\PianoStaff
\accepts Dynamics
}
}
}
Next: String quartet, Previous: Single staff, Up: Templates
This page is for LilyPond-2.10.25 (stable-branch).