Next: , Previous: Suggestions for writing LilyPond files, Up: Example templates



3.2 Single staff

3.2.1 Notes only

The first example gives you a staff with notes, suitable for a solo instrument or a melodic fragment. Cut and paste this into a file, add notes, and you're finished!

     \version "2.4.0"
     melody = \relative c' {
        \clef treble
        \key c \major
        \time 4/4
     
        a4 b c d
     }
     
     \score {
        \new Staff \melody
        \layout { }
        \midi { \tempo 4=60 }
     }

[image of music]

3.2.2 Notes and lyrics

The next example demonstrates a simple melody with lyrics. Cut and paste, add notes, then words for the lyrics. This example turns off automatic beaming, which is common for vocal parts. If you want to use automatic beaming, you'll have to change or comment out the relevant line.

     \version "2.4.0"
     melody = \relative c' {
        \clef treble
        \key c \major
        \time 4/4
     
        a4 b c d
     }
     
     text = \lyricmode {
        Aaa Bee Cee Dee
     }
     
     \score{
        <<
           \context Voice = one {
              \autoBeamOff
              \melody
           }
           \lyricsto "one" \new Lyrics \text
        >>
        \layout { }
        \midi { \tempo 4=60 }
     }

[image of music]

3.2.3 Notes and chords

Want to prepare a lead sheet with a melody and chords? Look no further!

     \version "2.4.0"
     melody = \relative c' {
        \clef treble
        \key c \major
        \time 4/4
     
        f4 e8[ c] d4 g |
        a2 ~ a2 |
     }
     
     harmonies = \chordmode {
        c4:m f:min7 g:maj c:aug d2:dim b:sus
     }
     
     \score {
        <<
           \context ChordNames {
              \set chordChanges = ##t
              \harmonies
           }
        \context Staff = one \melody
        >>
     
        \layout{ }
        \midi { \tempo 4=60}
     }

[image of music]

3.2.4 Notes, lyrics, and chords.

This template allows you to prepare a song with melody, words, and chords.

     \version "2.4.0"
     melody = \relative c' {
        \clef treble
        \key c \major
        \time 4/4
     
        a b c d
     }
     
     text = \lyricmode {
        Aaa Bee Cee Dee
     }
     
     harmonies = \chordmode {
        a2 c2
     }
     
     \score {
        <<
           \context ChordNames {
              \set chordChanges = ##t
              \harmonies
           }
        \context Voice = one {
           \autoBeamOff
           \melody
        }
        \lyricsto "one" \new Lyrics \text
        >>
        \layout { }
        \midi { \tempo 4=60 }
     }

[image of music]

Read comments on this page, or add one.

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

Report errors to <bug-lilypond@gnu.org>.

Other languages: English.
Using automatic language selection.