Lilypond Examples

From Arizona CopperSoft

Jump to: navigation, search

Contents

LilyPond

LilyPond is powerful software for typesetting music.

Fragment without Whitespace

This fragment has an extra space between the last note (c) and the end-tag (</lilypond>). This results in a small image without a lot of extra whitespace.

<lilypond>c d e f g a b c </lilypond>

c d e f g a b c

Fragment with Whitespace

This fragment does not have an extra space between the last note (c) and the end-tag (</lilypond>). This results in a large image with a lot of extra whitespace.

<lilypond>c d e f g a b c</lilypond>

c d e f g a b c

Full Example

Set the tagline in the header to "" in order to trim extra whitespace from the image.

<lilybook>

\header {
  title = "Jingle Bells"
  tagline = ""
}

\paper {
  indent = 0\mm
}

\layout {
  \context {
   \TabVoice
   \remove Beam_engraver
   \remove Stem_engraver
   \remove Tuplet_engraver
   \remove Script_engraver
   \remove Tie_engraver
   \remove Dots_engraver
 }
 \context {
   \TabStaff
   \remove Time_signature_engraver
 }
}

music = {
 g4 e' d' c'
 g2. g8 g8 
 g4 e' d' c' 
 a1
 |
 \break
 a4 f' e' d' b1 g'4 g' f' d' e'2. r4
 |
 \break
 g4 e' d' c' g1 g4 e' d' c' a2. a4
 |
 \break
 a4 f' e' d' g' g' g' g' a' g' f' d' c'2 g'2
 |
 \break
 e'4 e' e'2 e'4 e' e'2 e'4 g' c'4. d'8 e'1
 |
 \break
 f'4 f' f'4. f'8 f'4 e' e' e'8 e' e'4 d' d' e' d'2 g'2
 |
 \break
 e'4 e' e'2 e'4 e' e'2 e'4 g' c'4. d'8 e'1
 | 
 \break
 f'4 f' f'4. f'8 f'4 e' e' e'8 e'8 g'4 g' f' d' c' r c r
 |
 \break
 \bar "|."
}

guitarchords = {
 \chordmode { 
   c1 s s f 
   d:m g:7 s s 
   c s s s 
   d:m g:7 s c2 g2 
   c1 s s s 
   f c d:7 g:7
   c s s s
   f c g:7 c
 } 
}

words = \lyricmode {
 Dash-4 ing through the snow2. in4 a one horse o- pen sleigh;1
 O'er the fields we go, laugh- ing all the way.
 Bells on bob- tail ring mak- ing spir- its bright; What
 fun it is to ride and sing a sleigh- ing song to- night! Oh!
 Jin- gle bells, jin- gle bells, jin- gle all the way;
 Oh, what fun it is to ride in a one- horse o- pen sleigh! ____
 Jin- gle bells, jin- gle bells, jin- gle all the way;
 Oh, what fun it is to ride in a one- horse o- pen sleigh! ____
}

\book {
 \score {
   <<
     \new ChordNames {
       \guitarchords
     }
     \new FretBoards {
       \guitarchords
     }
     \context Staff {
       \clef "G_8"
       \key c \major
       \context Voice = "GuitarOne" {
         \tempo 4 = 120 
         \music
       }
     }
     \context TabStaff = "GuitarTwo" {
       \set TabStaff.minimumFret = #0
       \music
     }
     \lyricsto "GuitarOne" \new Lyrics \words
   >>
 }
}
</lilybook>


LilyPond error:
/usr/local/bin/lilypond: not found

Example from MediaWiki Lilypond Extension

The Mary Had a Little Lamb example. Strangely, this example does not have the extra whitespace. Well, not so strange now that I figured it out. Settings the tagline to "" is the trick.

Personal tools