What is a LilyPond file?

It’s a text format for storing sheet music, and many existing classical pieces have already been notated using it.

Example

Here is the some LilyPond source code.  It may be written in any text editor.  It may look intimidating, but scroll down to see what happens to it.

\version "2.16.0"
\include "english.ly"
\header {
	title = "Drowsy Maggie"
	composer = "Traditional"
}

\relative c' {
	\key e \minor
	\time 2/2

	\repeat volta 2 {
		e4 b'8 e, d' e, b' e, |
		e4 b'8 e, a fs d fs |
		e4 b'8 e, d' e, b' e, |
	}

	\alternative {
		{ b'8 a b cs d a fs d }
		{ b'8 a b cs d a fs a }
	}

	\bar "||" \break

	d4 fs8 d cs4 e8 cs |
	d8 e fs g a fs g e |
	d4 fs8 d cs4 e8 cs |
	b8 a b cs d a fs a |

	d4 fs8 d cs4 e8 cs |
	d8 e fs g a fs g e | 
	a8 fs g e fs d e cs |
	b8 a b cs d a fs d |

	\bar "||"

	e1

	\bar "|."
}

We can compile the source code using the LilyPond program.  It outputs nicely formatted sheet music, as seen below:

Sheet music for the traditional tune "Drowsy Maggie"

“Drowsy Maggie” as typeset by LilyPond. Click on the image to download a PDF.

That looks confusing.  Why not use a graphical editor?

It is possible to edit sheet music on your computer using a mouse and keyboard.  Popular choices include MuseScore (free and slightly ragged), Sibelius (popular but facing an uncertain future in 2012 ((Sibelius Users (www.sibeliususers.org) )) ), Finale (clunky but reliable) and Notion (shiny but incomplete).

Some of these applications have been in development for 20 years, but they still have problems:

  1. With the exception of MuseScore, the most power version of each application is expensive.
  2. It is hard to share music between composers.  Even sharing files between different versions of the same application often requires manual export.
  3. Upgrading to a new version may introduce formatting oddities into older scores.
  4. Editing with a mouse isn’t as perfect is it may seem.  Most graphical editors have a steep learning curve.  To use them effectively, you must master an odd combination of mouse and keyboard.
  5. Even the newest computers sometime struggles to display, edit and play a symphony orchestra score.
  6. Once again with the exception of MuseScore, these applications are “closed source”, so the developers may make unpopular decisions.

Despite this, I personally use Sibelius.  Other tools make it easier to write music, but nothing else makes it so easy to edit – to adjust pitches, move bars around, change key, and have the individual parts integrated so they update to reflect the score.

However, what if I were setting out to duplicate existing orchestral music?  What if I wanted to copy centuries-old engraved scores with precision?  What if I wanted to share with other people in a way that any person, using any computer, could rearrange?

In that case, I might choose a text format – and having chosed that, I might choose LilyPond.  Many people have already faced the same decision and made the same choice.

Free scores!  Just add parts!

If you’re looking for sheet music for a popular baroque or classical piece, you can usually find it at the International Music Score Library Project / Petrucci Music Library.  In August 2012 it exceed 214,000 pieces ((For some reason musicians often talk about “Petruccio”, but they seem to mean IMSLP/Petrucci.  It’s better to rememember IMSLP, because the website is at www.imslp.org.)).  So why aren’t they played more often?  Because, all too often, only the score is available – no parts.

The combination of low print quality and low-resolution scans can also make a piece illegible ((The fragment is from the IMSLP scan of “H.M.S. Pinafore” by Gilbert & Sullivan violin 1 part, page 30.)).

Fragment of sheet music for "H.M.S. Pinafore", showing blurry notes and accidentals

You can probably discern the rests and accidentals in this fragment, but could you read them accurately at regular print size, while playing?

But, given a score and enough time to clarify any ambiguous printing, you could notate these electronically, creating a clear and legible copy of the score.  Once you have the score, it is (usually) trivial to print individual parts.  That is precisely what you’ll find at The Mutopia Project and ChoralWiki.  Generous volunteers have taken many public domain scores ((Admittedly, the pieces currently available in LilyPond format represent at most 1% of the scores at IMSLP, but they disproportionately cover the most frequently performed works, especially from the Baroque period.)) and reproduced them in LilyPond.

Why do I need to know my music came from LilyPond?

Usually, you can find PDFs prepared for your convenience.  However, if it mentions that it was “typeset using www.LilyPond.org“, there are a few details to be aware of:

1. Use the source

The LilyPond files will often state which printed document they were transcribed from. If the LilyPond file could be released into the public domain, this source document should be public domain as well.  The version of “King Arthur” by Henry Purcell at ChoralWiki states that its source was by “Musical Antiquarian Society Publications, 1843”.  That 1843 printing is one of the versions of “King Arthur” by Henry Purcell at the IMSLP/Petrucci Music Library.  Why is this useful?  Because any oddities in the modern parts can be compared against the score.

2. Credit where it’s due

The PDFs may have been a free download, but someone still owns the copyright.  Often they choose to license it under one of the Creative Commons licenses ((To learn more about the Creative Commons philosophy and licenses, visit creativecommons.org.)), which give you a lot of freedom.  If they were kind enough to do this, make sure you know which license they used.  In particular, if they used the Creative Commons Attribution license, your only obligation is to credit the copyist/arranger, so make sure you do that.  Give them the credit you would extend to any other arranger in your concert programme.

Often the music includes the copyist’s e-mail address.  If so, send them thanks for their hard work.  If you found any errors (they’re all too easy to make when copying sheet music, and can often be hard to detect), politely mention those too.  Make sure you clearly describe where the error is and what it should be changed to.

If you use a lot of music from any of the major archives, consider making a donation to that archive.  Even if the music is public domain, keeping it online and making it available is not free.

3. Edit where it’s necessary

If you don’t have the exact instruments in the score, or some other detail of the music as provided doesn’t suit you, you can download the LilyPond source files and change it yourself.

This is easier than copying it by hand, but it is not completely trivial either.  So, see the next two posts:

More LilyPond

  1. What is a LilyPond file?
  2. How do I read this LilyPond file?
  3. How do I edit a LilyPond file?
  4. How do I transpose a LilyPond part?
  5. Can I import a LilyPond file into my graphical notation editor?

2 thoughts on “What is a LilyPond file?

    • Sorry, I don’t have any other examples. To get this working I spent many hours with the LilyPond – Learning Manual. The LilyPond documentation also recommends Ben Lemon’s tutorial videos. I also learnt a lot from downloading simple (solo and duet) pieces from The Mutopia Project and working out how they fitted together. Just make sure you’re looking at code for a recent version of LilyPond, or it won’t help at all.

      Or do you just want to notate simple tunes like “Drowsy Maggie” here? If so, that’s easier to do in ABC Notation.

Leave a Reply

Your e-mail address will not be published or shared with third parties.

First comments from new name/e-mail combinations will be held in moderation.