Next: , Previous: Chords, Up: Top


Piano

clusters.ly

Clusters are a device to denote that a complete range of notes is to be played.

\layout {
  ragged-right = ##t 
}

fragment = \relative c' {
  c4 f4 <e d'>4
  <g a>8 <e a> a4 c2 <d b>4 e4 
  c4
}

<<
  \new Staff \fragment
  \new Staff \makeClusters \fragment
>>

[image of music]

demo-midiinstruments.ly

Problem: How to know which MidiInstrument would be best for your composition? Solution: A Lilypond demo file.

\score { 
  \new Staff <<
    \new Voice { \melodie 
    } %Voice
  >> %Staff
  \layout {  }
} %score

\score { 
  \new Staff <<
    \tempo 4 = 180 
    %\set Staff.instrumentName="S/A"
    %\set Staff.midiMinimumVolume = #0.2 
    %\set Staff.midiMaximumVolume = #0.4
    %\set Voice.dynamicAbsoluteVolumeFunction = #0.6
    \new Voice { r \mf
      \set Staff.midiInstrument="acoustic grand" \melodie
      \set Staff.midiInstrument="bright acoustic" \melodie
      \set Staff.midiInstrument="electric grand" \melodie
      \set Staff.midiInstrument="honky-tonk" \melodie
      \set Staff.midiInstrument="electric piano 1" \melodie
      \set Staff.midiInstrument="electric piano 2" \melodie
      \set Staff.midiInstrument="harpsichord" \melodie
      \set Staff.midiInstrument="clav" \melodie
      \set Staff.midiInstrument="celesta" \melodie
      \set Staff.midiInstrument="glockenspiel" \melodie
      \set Staff.midiInstrument="music box" \melodie
      \set Staff.midiInstrument="vibraphone" \melodie
      \set Staff.midiInstrument="marimba" \melodie
      \set Staff.midiInstrument="xylophone" \melodie
      \set Staff.midiInstrument="tubular bells" \melodie
      \set Staff.midiInstrument="dulcimer" \melodie
      \set Staff.midiInstrument="drawbar organ" \melodie
      \set Staff.midiInstrument="percussive organ" \melodie
      \set Staff.midiInstrument="rock organ" \melodie
      \set Staff.midiInstrument="church organ" \melodie
      \set Staff.midiInstrument="reed organ" \melodie
      \set Staff.midiInstrument="accordion" \melodie
      \set Staff.midiInstrument="harmonica" \melodie
      \set Staff.midiInstrument="concertina" \melodie
      \set Staff.midiInstrument="acoustic guitar (nylon)" \melodie
      \set Staff.midiInstrument="acoustic guitar (steel)" \melodie
      \set Staff.midiInstrument="electric guitar (jazz)" \melodie
      \set Staff.midiInstrument="electric guitar (clean)" \melodie
      \set Staff.midiInstrument="electric guitar (muted)" \melodie
      \set Staff.midiInstrument="overdriven guitar" \melodie
      \set Staff.midiInstrument="distorted guitar" \melodie
      \set Staff.midiInstrument="acoustic bass" \melodie
      \set Staff.midiInstrument="electric bass (finger)" \melodie
      \set Staff.midiInstrument="electric bass (pick)" \melodie
      \set Staff.midiInstrument="fretless bass" \melodie
      \set Staff.midiInstrument="slap bass 1" \melodie
      \set Staff.midiInstrument="slap bass 2" \melodie
      \set Staff.midiInstrument="synth bass 1" \melodie
      \set Staff.midiInstrument="synth bass 2" \melodie
      \set Staff.midiInstrument="violin" \melodie
      \set Staff.midiInstrument="viola" \melodie
      \set Staff.midiInstrument="cello" \melodie
      \set Staff.midiInstrument="contrabass" \melodie
      \set Staff.midiInstrument="tremolo strings" \melodie
      \set Staff.midiInstrument="pizzicato strings" \melodie
      \set Staff.midiInstrument="orchestral strings" \melodie
      \set Staff.midiInstrument="timpani" \melodie
      \set Staff.midiInstrument="string ensemble 1" \melodie
      \set Staff.midiInstrument="string ensemble 2" \melodie
      \set Staff.midiInstrument="synthstrings 1" \melodie
      \set Staff.midiInstrument="synthstrings 2" \melodie
      \set Staff.midiInstrument="choir aahs" \melodie
      \set Staff.midiInstrument="voice oohs" \melodie
      \set Staff.midiInstrument="synth voice" \melodie
      \set Staff.midiInstrument="orchestra hit" \melodie
      \set Staff.midiInstrument="trumpet" \melodie
      \set Staff.midiInstrument="trombone" \melodie
      \set Staff.midiInstrument="tuba" \melodie
      \set Staff.midiInstrument="muted trumpet" \melodie
      \set Staff.midiInstrument="french horn" \melodie
      \set Staff.midiInstrument="brass section" \melodie
      \set Staff.midiInstrument="synthbrass 1" \melodie
      \set Staff.midiInstrument="synthbrass 2" \melodie
      \set Staff.midiInstrument="soprano sax" \melodie
      \set Staff.midiInstrument="alto sax" \melodie
      \set Staff.midiInstrument="tenor sax" \melodie
      \set Staff.midiInstrument="baritone sax" \melodie
      \set Staff.midiInstrument="oboe" \melodie
      \set Staff.midiInstrument="english horn" \melodie
      \set Staff.midiInstrument="bassoon" \melodie
      \set Staff.midiInstrument="clarinet" \melodie
      \set Staff.midiInstrument="piccolo" \melodie
      \set Staff.midiInstrument="flute" \melodie
      \set Staff.midiInstrument="recorder" \melodie
      \set Staff.midiInstrument="pan flute" \melodie
      \set Staff.midiInstrument="blown bottle" \melodie
      \set Staff.midiInstrument="shakuhachi" \melodie
      \set Staff.midiInstrument="whistle" \melodie
      \set Staff.midiInstrument="ocarina" \melodie
      \set Staff.midiInstrument="lead 1 (square)" \melodie
      \set Staff.midiInstrument="lead 2 (sawtooth)" \melodie
      \set Staff.midiInstrument="lead 3 (calliope)" \melodie
      \set Staff.midiInstrument="lead 4 (chiff)" \melodie
      \set Staff.midiInstrument="lead 5 (charang)" \melodie
      \set Staff.midiInstrument="lead 6 (voice)" \melodie
      \set Staff.midiInstrument="lead 7 (fifths)" \melodie
      \set Staff.midiInstrument="lead 8 (bass+lead)" \melodie
      \set Staff.midiInstrument="pad 1 (new age)" \melodie
      \set Staff.midiInstrument="pad 2 (warm)" \melodie
      \set Staff.midiInstrument="pad 3 (polysynth)" \melodie
      \set Staff.midiInstrument="pad 4 (choir)" \melodie
      \set Staff.midiInstrument="pad 5 (bowed)" \melodie
      \set Staff.midiInstrument="pad 6 (metallic)" \melodie
      \set Staff.midiInstrument="pad 7 (halo)" \melodie
      \set Staff.midiInstrument="pad 8 (sweep)" \melodie
      \set Staff.midiInstrument="fx 1 (rain)" \melodie
      \set Staff.midiInstrument="fx 2 (soundtrack)" \melodie
      \set Staff.midiInstrument="fx 3 (crystal)" \melodie
      \set Staff.midiInstrument="fx 4 (atmosphere)" \melodie
      \set Staff.midiInstrument="fx 5 (brightness)" \melodie
      \set Staff.midiInstrument="fx 6 (goblins)" \melodie
      \set Staff.midiInstrument="fx 7 (echoes)" \melodie
      \set Staff.midiInstrument="fx 8 (sci-fi)" \melodie
      \set Staff.midiInstrument="sitar" \melodie
      \set Staff.midiInstrument="banjo" \melodie
      \set Staff.midiInstrument="shamisen" \melodie
      \set Staff.midiInstrument="koto" \melodie
      \set Staff.midiInstrument="kalimba" \melodie
      \set Staff.midiInstrument="bagpipe" \melodie
      \set Staff.midiInstrument="fiddle" \melodie
      \set Staff.midiInstrument="shanai" \melodie
      \set Staff.midiInstrument="tinkle bell" \melodie
      \set Staff.midiInstrument="agogo" \melodie
      \set Staff.midiInstrument="steel drums" \melodie
      \set Staff.midiInstrument="woodblock" \melodie
      \set Staff.midiInstrument="taiko drum" \melodie
      \set Staff.midiInstrument="melodic tom" \melodie
      \set Staff.midiInstrument="synth drum" \melodie
      \set Staff.midiInstrument="reverse cymbal" \melodie
      \set Staff.midiInstrument="guitar fret noise" \melodie
      \set Staff.midiInstrument="breath noise" \melodie
      \set Staff.midiInstrument="seashore" \melodie
      \set Staff.midiInstrument="bird tweet" \melodie
      \set Staff.midiInstrument="telephone ring" \melodie
      \set Staff.midiInstrument="helicopter" \melodie
      \set Staff.midiInstrument="applause" \melodie
      \set Staff.midiInstrument="gunshot" \melodie
    } %Voice
  >> %Staff
  \midi { }
} %score


[image of music]

jazz-combo-template.ly

Jazz tune for combo (horns, guitar, piano, bass, drums).


[image of music]

piano-template-simple.ly

Here is a simple piano staff with some notes.

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 { }
         }

[image of music]

piano-template-with-centered-dynamics.ly

Many piano scores have the dynamics centered between the two staves. This requires a bit of tweaking to implement, but since the template is right here, you don't have to do the tweaking yourself.

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)
      \override DynamicLineSpanner #'Y-offset = #0
      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
      
      \consists "Skip_event_swallow_translator"
      
      \consists "Axis_group_engraver"
    }
    \context {
      \PianoStaff
      \accepts Dynamics
    }
  }
}
\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
    }
  }
}

[image of music]

piano-template-with-centered-lyrics.ly

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).

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 { }
         }

[image of music]

piano-template-with-melody-and-lyrics.ly

Here is a typical song format: one staff with the melody and lyrics, with piano accompaniment underneath.

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 { }
         }

[image of music]

vocal-ensemble-template-with-automatic-piano-reduction.ly

This template adds an automatic piano reduction to the standard SATB vocal score demonstrated in "Vocal ensemble template". This demonstrates one of the strengths of LilyPond – you can use a music definition more than once. If you make any changes to the vocal notes (say, tenorMusic), then the changes will also apply to the piano reduction.

global = {
            \key c \major
            \time 4/4
         }
         
         sopMusic = \relative c'' {
            c4 c c8[( b)] c4
         }
         sopWords = \lyricmode {
            hi hi hi hi
         }
         
         altoMusic = \relative c' {
            e4 f d e
         }
         altoWords =\lyricmode {
            ha ha ha ha
         }
         
         tenorMusic = \relative c' {
            g4 a f g
         }
         tenorWords = \lyricmode {
            hu hu hu hu
         }
         
         bassMusic = \relative c {
            c4 c g c
         }
         bassWords = \lyricmode {
            ho ho ho ho
         }
         
         \score {
           <<
             \new ChoirStaff <<
               \new Lyrics = sopranos { s1 }
               \new Staff = women <<
                 \new Voice =
                   "sopranos" { \voiceOne << \global \sopMusic >> }
                 \new Voice =
                   "altos" { \voiceTwo << \global \altoMusic >> }
               >>
               \new Lyrics = "altos" { s1 }
               \new Lyrics = "tenors" { s1 }
               \new Staff = men <<
                 \clef bass
                 \new Voice =
                   "tenors" { \voiceOne <<\global \tenorMusic >> }
                 \new Voice =
                   "basses" { \voiceTwo <<\global \bassMusic >> }
               >>
               \new Lyrics = basses { s1 }
         
               \context Lyrics = sopranos \lyricsto sopranos \sopWords
               \context Lyrics = altos \lyricsto altos \altoWords
               \context Lyrics = tenors \lyricsto tenors \tenorWords
               \context Lyrics = basses \lyricsto basses \bassWords
             >>
           \new PianoStaff <<
             \new Staff <<
               \set Staff.printPartCombineTexts = ##f
               \partcombine
               << \global \sopMusic >>
               << \global \altoMusic >>
             >>
             \new Staff <<
               \clef bass
               \set Staff.printPartCombineTexts = ##f
               \partcombine
               << \global \tenorMusic >>
               << \global \bassMusic >>
             >>
            >>
           >>
           \layout {
             \context {
               % a little smaller so lyrics
               % can be closer to the staff
               \Staff
                 \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
             }
           }
         }

[image of music]



Next: , Previous: Chords, Up: Top

This page is for LilyPond-2.11.40 (development-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Your suggestions for the documentation are welcome.