# App o’ the Morning: LilyPond

The tin whistle is a folk instrument; and the wonder and glory of folk music is that although it consists mostly of old standards, the old standards aren’t particularly standard. For any well-known tune there will be any number of versions extant, with different words, slightly different melodies, different arrangements, and so on. And then, when you learn to play the tune, you’re not expected to simply play it just like everyone else—instead, you’re expected to take it and make it your own, and play it the way you want to play it.

And that means that even if you can find sheet music for the song, you’re ultimately going to want to make changes to it. You might want to some ornamentation here, or repeat that phrase, or change that note there, or change the rhythm slightly. Or you might find it in the key of F, and you’d really rather have it in D.

Now, you could simply write it all out longhand on music paper; but given a tablet and applications like ForScore, you’re going to want it in electronic form. Now, as it happens there are many, many programs for music typesetting that will let you enter your score and save it as a PDF file. Some of them are extremely expensive; others are less so. And then there’s LilyPond, which is free and works quite well—if you don’t mind thinking like a programmer.

For example, I found some sheet music for a song called “Tramps and Hawkers”; but it wasn’t quite right. It was written as 3/4 time, when it plays more like 6/8 time; and one note sounded off to me. (That is to say, it sounded different than the recording I’m familiar with.) I wanted to fix it, so I re-arranged it in LilyPond.

When you start LilyPond, it gives you a text editor window to type the tune into, using its own notation language. Here’s what I ended up with for “Tramps and Hawkers”:

\relative c'' {
\key g \major
\time 6/8

\partial 4
g8 a | b4 d8 b a g | a4 b8 g4 e8 | d4 e8 g4 a8 | g4.~ g8 b c | \break
d4 d8 b c d | e fis e d b a | g4 a8 b a g | e4.~ e8 b' c | \break
d4 d8 d b d | e fis e d b a | g4 a8 b a g | e4. g4 a8 | \break
b4 d8 b a g | a4 b8 g4 e8 | d4 e8 g4 a8 | g4.~ g4.

\bar "|."
}


As you can see, it’s in G major and 6/8 time. The first measure (a pickup) is “g8 a“. “g8” means you want G as an 8th note, and “a” means A. Since the duration is not given, the A will also be an 8th note.

The vertical bar indicates the beginning of a new measure, which is “b4 d8 b a g“, or a B quarter note, followed by D, B, A, and G as eight notes.

Now, each of the notes A through G appears multiple times on the staff. How does LilyPond know which one you want? Essentially, it picks the one closest to the previous note. The code “\relative c''” means that the tune starts near C two octaves above middle C; and after that each note is relative to its predecessor.

Sometimes, of course, the nearest note is not what you want. In the last measure on the second line, you’ll see this: “e4.~ e8 b' c“. The apostrophe in “b'” means that the note is one octave up from what LilyPond expects. Similarly, you can move it down an octave by writing “b,“. (For the record, the “e4.~ e8” is an E as a dotted quarter note, with a tie to the subsequent eighth note.)

Here’s what it looks like all put together:

LilyPond is not for everyone. If the idea of writing and debugging code repels you, you’ll want to look for something else. Me, I’m a programmer; writing and debugging code is where I live. And then…many years ago, while I was learning the recorder, I bought a program called Noteworthy Composer. It was a nice piece of software, and I did a number of tunes with it. Then I switched from Windows to Macintosh…and Noteworthy Composer is Windows only. Instantly, the score files I’d created with Noteworthy Composer were worthless to me. But even if LilyPond went away tomorrow, I’d still have the input text for each tune, and I could still read it myself.

I don’t know whether I’ll stick with LilyPond long-term, but so far it’s been able to do everything I need; and I know it’s capable of many things (such as multi-part scores) that I don’t expect ever to need. There’s a reasonable tutorial at the LilyPond website, and lots of reference material as well.