Next: , Previous: Chords, Up: Top


Keyboards

These snippets illustrate the Notation Reference, section Keyboard instruments.

Accordion-discant symbols

Accordion discant-specific symbols are added using \markup. The vertical placement of the symbols can be tweaked by changing the \raise arguments.

discant = \markup {
  \musicglyph #"accordion.accDiscant"
}
dot = \markup {
  \musicglyph #"accordion.accDot"
}

% 16 voets register
accBasson = ^\markup {
  \combine
  \discant
  \raise #0.5 \dot
}

% een korig 8 en 16 voets register
accBandon = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \raise #1.5 \dot
}

accVCello = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \translate #'(1 . 0) \raise #1.5 \dot
}

% 4-8-16 voets register
accHarmon = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \raise #2.5 \dot
}

accTrombon = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \combine
          \translate #'(1 . 0) \raise #1.5 \dot
          \translate #'(-1 . 0) \raise #1.5 \dot
}

% eenkorig 4 en 16 voets register
accOrgan = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \raise #2.5 \dot
}

accMaster = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \combine
          \translate #'(1 . 0) \raise #1.5 \dot
          \combine
            \translate #'(-1 . 0) \raise #1.5 \dot
            \raise #2.5 \dot
}

accAccord = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \combine
        \translate #'(1 . 0) \raise #1.5 \dot
        \combine
          \translate #'(-1 . 0) \raise #1.5 \dot
          \raise #2.5 \dot
}

accMusette = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \combine
        \translate #'(1 . 0) \raise #1.5 \dot
        \translate #'(-1 . 0) \raise #1.5 \dot
}

accCeleste = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \translate #'(-1 . 0) \raise #1.5 \dot
}

accOboe = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \raise #2.5 \dot
}

accClarin = ^\markup {
  \combine
    \discant
    \raise #1.5 \dot
}

accPiccolo = ^\markup {
    \combine
       \discant 
       \raise #2.5 \dot
}

accViolin = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \combine
        \translate #'(1 . 0) \raise #1.5 \dot
        \raise #2.5 \dot
}

\relative c'' {
  c4 d\accBasson e f
  c4 d\accBandon e f
  c4 d\accVCello e f
  c4 d\accHarmon e f
  c4 d\accTrombon e f
  c4 d\accOrgan e f
  c4 d\accMaster e f
  c4 d\accAccord e f
  c4 d\accMusette e f
  c4 d\accCeleste e f
  c4 d\accOboe e f
  c4 d\accClarin e f
  c4 d\accPiccolo e f
  c4 d\accViolin e f
}

[image of music]

Clusters

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

\layout {
  ragged-right = ##t 
}

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

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

[image of music]

Controlling the placement of chord fingerings

The placement of fingering numbers can be controlled precisely.

\relative c' {
  \set fingeringOrientations = #'(left)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(down)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(right)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(up)
  <c-1 e-3 a-5>4
  \set fingeringOrientations = #'(left down)
  <c-1 e-3 a-5>2
  \set fingeringOrientations = #'(up right down)
  <c-1 e-3 a-5>2
}

[image of music]

Creating slurs across voices

In some situations, it may be necessary to create slurs between notes from different voices.

The solution is to add invisible notes to one of the voices, using \hideNotes.

This example is measure 235 of the Ciaconna from Bach's 2nd Partita for solo violin, BWV 1004.

\relative c' {
  << {
    d16( a') s a s a[ s a] s a[ s a]
  }
  \\
  {
    \slurUp
    bes,16[ s e](
    \hideNotes a)
    \unHideNotes f[(
    \hideNotes a)
    \unHideNotes fis](
    \hideNotes a)
    \unHideNotes g[(
    \hideNotes a)
    \unHideNotes gis](
    \hideNotes a)
  } >>
}

[image of music]

Demo MidiInstruments

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

\header {
  title = "Demo of all midi sounds"
  arranger = "Myself "
}

basemelodie = \relative c' {
  c4. \mf g  c16 b' c d
  e16 d e f g4 g'4 r
  R1
}
melodie = { \tempo 4 = 150 \basemelodie }

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

\score { 
  \new Staff <<
    %\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
    }
  >>
  \midi { }
}

[image of music]

Fine-tuning pedal brackets

For fine-tuning the appearance of a pedal bracket, the properties edge-width, edge-height, and shorten-pair of PianoPedalBracket objects can be modified. For example, the bracket may be extended to the right edge of the note head:

\relative c'' {
  \override Staff.PianoPedalBracket #'shorten-pair = #'(0 . -1.0)
  c4\sostenutoOn d e c,
  f4 g a2\sostenutoOff
}

[image of music]

Indicating cross-staff chords with arpeggio bracket

An arpeggio bracket can indicate that notes on two different staves are to be played with the same hand. In order to do this, the PianoStaff must be set to accept cross-staff arpeggios and the arpeggios must be set to the bracket shape in the PianoStaff context.

(Debussy, Les collines d’Anacapri, m. 65)

\paper { ragged-right = ##t }

\new PianoStaff <<
  \set PianoStaff.connectArpeggios = ##t
  \override PianoStaff.Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket
  \new Staff {
    \relative c' {
      \key b \major
      \time 6/8
      b8-.(\arpeggio fis'-.\> cis-. e-. gis-. b-.)\!\fermata^\laissezVibrer
      \bar "||"
    }
  }
  \new Staff {
    \relative c' {
      \clef bass
      \key b \major
      <<
        {
          <a e cis>2.\arpeggio
        }
        \\
        {
          <a, e a,>2.
        }
      >>
    }
  }
>>

[image of music]

Jazz combo template

This is quite an advanced template, for a jazz ensemble. Note that all instruments are notated in \key c \major. This refers to the key in concert pitch; the key will be automatically transposed if the music is within a \transpose section.

\header {
  title = "Song"
  subtitle = "(tune)"
  composer = "Me"
  meter = "moderato"
  piece = "Swing"
  tagline = \markup {
    \column {
      "LilyPond example file by Amelie Zapf,"
      "Berlin 07/07/2003"
    }
  }
}

%#(set-global-staff-size 16)
\include "english.ly"

%%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%%

sl = {
  \override NoteHead #'style = #'slash
  \override Stem #'transparent = ##t
}
nsl = {
  \revert NoteHead #'style
  \revert Stem #'transparent
}
crOn = \override NoteHead #'style = #'cross
crOff = \revert NoteHead #'style

%% insert chord name style stuff here.

jazzChords = { }

%%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%

global = { \time 4/4 }

Key = { \key c \major }

% ############ Horns ############

% ------ Trumpet ------
trpt = \transpose c d \relative c'' {
  \Key
  c1 | c | c |
}
trpHarmony = \transpose c' d {
  \jazzChords
}
trumpet = {
  \global
  \set Staff.instrumentName = #"Trumpet"
  \clef treble
  <<
    \trpt
  >>
}

% ------ Alto Saxophone ------
alto = \transpose c a \relative c' {
  \Key
  c1 | c | c |
}
altoHarmony = \transpose c' a {
  \jazzChords
}
altoSax = {
  \global
  \set Staff.instrumentName = #"Alto Sax"
  \clef treble
  <<
    \alto
  >>
}

% ------ Baritone Saxophone ------
bari = \transpose c a' \relative c {
  \Key
  c1
  c1
  \sl
  d4^"Solo" d d d
  \nsl
}
bariHarmony = \transpose c' a \chordmode {
  \jazzChords s1 s d2:maj e:m7
}
bariSax = {
  \global
  \set Staff.instrumentName = #"Bari Sax"
  \clef treble
  <<
    \bari
  >>
}

% ------ Trombone ------
tbone = \relative c {
  \Key
  c1 | c | c
}
tboneHarmony = \chordmode {
  \jazzChords
}
trombone = {
  \global
  \set Staff.instrumentName = #"Trombone"
  \clef bass
  <<
    \tbone
  >>
}

% ############ Rhythm Section #############

% ------ Guitar ------
gtr = \relative c'' {
  \Key
  c1
  \sl
  b4 b b b
  \nsl
  c1
}
gtrHarmony = \chordmode {
  \jazzChords
  s1 c2:min7+ d2:maj9
}
guitar = {
  \global
  \set Staff.instrumentName = #"Guitar"
  \clef treble
  <<
    \gtr
  >>
}

%% ------ Piano ------
rhUpper = \relative c'' {
  \voiceOne
  \Key
  c1 | c | c
}
rhLower = \relative c' {
  \voiceTwo
  \Key
  e1 | e | e
}

lhUpper = \relative c' {
  \voiceOne
  \Key
  g1 | g | g
}
lhLower = \relative c {
  \voiceTwo
  \Key
  c1 | c | c
}

PianoRH = {
  \clef treble
  \global
  \set Staff.midiInstrument = #"acoustic grand"
  <<
    \new Voice = "one" \rhUpper
    \new Voice = "two" \rhLower
  >>
}
PianoLH = {
  \clef bass
  \global
  \set Staff.midiInstrument = "acoustic grand"
  <<
    \new Voice = "one" \lhUpper
    \new Voice = "two" \lhLower
  >>
}

piano = {
  <<
    \set PianoStaff.instrumentName = #"Piano"
    \new Staff = "upper" \PianoRH
    \new Staff = "lower" \PianoLH
  >>
}

% ------ Bass Guitar ------
Bass = \relative c {
  \Key
  c1 | c | c
}
bass = {
  \global
  \set Staff.instrumentName = #"Bass"
  \clef bass
  <<
    \Bass
  >>
}

% ------ Drums ------
up = \drummode {
  \voiceOne
  hh4 <hh sn> hh <hh sn>
  hh4 <hh sn> hh <hh sn>
  hh4 <hh sn> hh <hh sn>
}
down = \drummode {
  \voiceTwo
  bd4 s bd s
  bd4 s bd s
  bd4 s bd s
}

drumContents = {
  \global
  <<
    \set DrumStaff.instrumentName = #"Drums"
    \new DrumVoice \up
    \new DrumVoice \down
  >>
}

%%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%

\score {
  <<
    \new StaffGroup = "horns" <<
      \new Staff = "trumpet" \trumpet
      \new Staff = "altosax" \altoSax
      \new ChordNames = "barichords" \bariHarmony
      \new Staff = "barisax" \bariSax
      \new Staff = "trombone" \trombone
    >>
    
    \new StaffGroup = "rhythm" <<
      \new ChordNames = "chords" \gtrHarmony
      \new Staff = "guitar" \guitar
      \new PianoStaff = "piano" \piano
      \new Staff = "bass" \bass
      \new DrumStaff \drumContents
    >>
  >>
  
  \layout {
    \context { \RemoveEmptyStaffContext }
    \context {
      \Score
      \override BarNumber #'padding = #3
      \override RehearsalMark #'padding = #2
      skipBars = ##t
    }
  }
  
  \midi { }
}

[image of music]

Laissez vibrer ties

Laissez vibrer ties have a fixed size. Their formatting can be tuned using 'tie-configuration.

\relative c' {
  <c e g>4\laissezVibrer r <c f g>\laissezVibrer r
  <c d f g>4\laissezVibrer r <c d f g>4.\laissezVibrer r8

  <c d e f>4\laissezVibrer r
  \override LaissezVibrerTieColumn #'tie-configuration
     = #`((-7 . ,DOWN)
          (-5 . ,DOWN)
          (-3 . ,UP)
          (-1 . ,UP))
  <c d e f>4\laissezVibrer r
}

[image of music]

Piano template (simple)

Here is a simple piano staff with some notes.

upper = \relative c'' {
  \clef treble
  \key c \major
  \time 4/4
  
  a4 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

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
  
  a4 b c d
}

lower = \relative c {
  \clef bass
  \key c \major
  \time 4/4
  
  a2 c
}

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

pedal = {
  s2\sustainOn s\sustainOff
}

\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
      % So that \cresc works, for example.
      \alias Voice
      \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 \pedal >>
    \new Staff = "lower" << \lower \dynamics \pedal >>
  >>
  \midi { }
}

[image of music]

Piano template with centered lyrics

Instead of having a full staff for the melody and lyrics, lyrics can be centered between the staves of a piano staff.

upper = \relative c'' {
  \clef treble
  \key c \major
  \time 4/4
  
  a4 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 { \lower }
  >>
  \layout {
    \context {
      \GrandStaff
      \accepts "Lyrics"
    }
    \context {
      \Lyrics
      \consists "Bar_engraver"
    }
  }
  \midi { }
}

[image of music]

Piano template with melody and lyrics

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
  
  a4 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

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 any changes are made 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]

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

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

Your suggestions for the documentation are welcome.