Sunday, February 28, 2010

Lilypond - music notation hard core

GarageBand for MacOSX comes with some great free music lessons.

I've been working my way through the piano ones, and they're excellent for keeping up the focus and motivation by giving some quick results, and in the "Play" section rewarding you with an accompaniment for your efforts that makes even an average performance sound pretty good.

Trouble is, when you have a minute or two with the keyboard and just want to practice some of what you've learned going back to GarageBand and firing up the lesson, scrolling to the part you're having trouble with is quite a pain.
It would be really handy to have some way to print out the score - but there isn't.

Well there is a tool that makes it pretty easy to code up musical scores, especially ones that have lots of repititive sections like the GarageBand lessons.

Its called Lilypond, and although it requires some command-line fu, to get it to do your bidding the results are nothing short of spectacular.

The first step is to go to the Lilypond site and download the version for your computer.

When you first run Lilypond it will show a sample file with a short scale. The section with "Welcome to Lilypond" is bracketed with %{ and }, so its treated as a comment - the rest of the sample file is lilypond music notation!

Choose select all, and delete the contents of the sample file, and replace it with your own notation.

Get started quickly by picking one of their templates that is close to the result you want, and modifying it rather than starting with a blank slate.

The notation may look a bit daunting at first, but its actually pretty simple and you can learn just enough to achieve your goals by following the excellent documentation.

I laid out my notation with the treble staff first, and then the bass - all with one measure to a line. That allowed me to quickly find the measure I had made a mistake on (since lilypond conveniently numbers your measures).

Once you have your text file prepared, you run the "Typeset file" command from the "Compile" menu and the PDF of your music appears.

Here's a screenshot of the final result.

To start working really effectively with Lilypond, you should understand that at its heart its a simple command line tool, designed for one job - taking Lilypond files, called something like "", processing them, and producing musical score as a result.

Here's how to run Lilypond from the command line, assuming its installed in MacOSX's /Applications folder:
/Applications/ -o "~/Documents" "~/"
The ~/Documents is the folder where the resulting files will be dropped.

Given that Lilypond is really a command line application the GUI program that you get on MacOSX or Windows is kind of tacked on and really isn't needed - in fact the editor that comes with Lilypond is really meant to be a "get you past first base" kind of thing.

I personally use the VIM editor, which is hard core - not for everyone. If you're a fan of vim however, you can find a set of indentation and colouration files inside the application:

Copy those into your .vim directory to get nicely indented and syntax highlighted editing inside vim.

To work with lilypond from the command line, on MacOSX download a handy script, and run it from the terminal. The script has the above lilypond invocation inside, and will wait for you to pass the path of your file to it, and then present you with the result. You then get the option to either run lilypond again on your file (presumably after you've made some edits) or to quit.

Good luck with your next great score!


  1. I’ve also tried the GarageBand and I’m quite satisfied with it but I also agreed with the disadvantages you have cited here Thanks for the updates, it seems to me that the Lilypond is quite helpful to all music lovers and wants to learn. I wonder if the new album of Harry Shearer could be learn using this. The screenshot that you have provided and links for the codes is truly helpful, I’ll surely check it out. And hope for more updates here.

  2. Lily Pond is a great product but very sophisticated and beyond the needs of the vast majority of people. I use a
    slow down music product called Song Surgeon and it has only very basic tab/music notation section, but for my needs of trying to figure out a tune it works just fine.


Hi, thanks for leaving your thoughtful on-topic comment!