Sheet music with LilyPond and Frescobaldi

LilyPond is a music engraving software. According to the website, “it brings the aesthetics of traditionally engraved music to computer printouts.” I always rely on it every time I have to write a score. It’s quick, powerful and – of course – with a beautiful output.

Unfortunately, LilyPond is not so easy for the newbie when more features are needed. The advanced stuff might take a while to figure out what’s going on. Besides, not everybody is fond of a terminal window. Thankfully, there is Frescobaldi. This awesome software is is named after Girolamo Frescobaldi, an Italian musician and one of the most important composers of keyboard music in the late Renaissance and early Baroque periods.

Frescobaldi is a LilyPond sheet music text editor for Linux. It aims to be powerful, yet lightweight and easy to use.  You can install it through your favorite package manager. In my case, a simple

yum install frescobaldi

did the job.

:)

So let’s run it.

The main window and editor.

Plain and simple, this is the main window and editor. I can type the commands by hand, but of course, Frescobaldi can help us. It’s way funnier.

:)
Setting up a new score.

First things first, so let’s setup a new score. Frescobaldi helps us decide which elements of the LilyPond universe we’ll be using. It’s easy, just click in the LilyPond menu and choose the Setup new score option.

Titles and headers.

As part of the celebrations of our one year birthday, let’s create a new score called Happy Birthday TeX.sx. This tab is related to titles and headers, so we fill out the info we want to be displayed.

:)
Parts.

Now we can add parts to our score! As this is a simple example, let’s stick only with the piano – both hands. We can add other instruments and parts as well.

The settings.

In this tab, we adjust the score setttings, like key signature, time signature and metronome. I simply changed the time signature to 3/4 and we are ready to go. Click OK.

The generated code.

Easy as pie! The code is automatically generated! Now I only need to type the actual notes for both hands:

Right hand:
right = \relative c” {
  \global
  % Music follows here.
  r2 c8 c
  a’4 g f
  g2 e4
  f r f
  g2 c,4
  a’ b c
  g2 e8 e
  f4 e d
  c2.
  r2.
  \bar “|.”
}
Left hand:
left = \relative c {
  \global
  % Music follows here.
  c4 <e g> <e g>
  f4 <a c> <a c>
  c,4 <e g> <e g>
  g,4 <b d> <b d>
  c4 <e g> <e g>
  f4 <a c> <a c>
  c,4 <e g> <e g>
  g,4 <b d> <b d>
  c4 <e g> <e g>
  c2. \bar “|.”
}
Take a look on this great introduction to LilyPond input.

Wait, is that it?

:)

We can actually focus on our melody! The file is now saved as happybirthday.ly.

Running LilyPond.

Done! Our first score was sucessfully generated. Frescobaldi has a built-in PDF preview, so we can check if our score is the way we want. Let’s take a look in the output:

Happy Birthday TeX.sx - Score 1.

Great! What if I want to add lyrics? It’s easier than we think!

Code completion.

Next to the right hand part, I need to add a

\addlyrics{ }

block. As I type, Frescobaldi suggests me what command I can use.

Adding lyrics.

Now it’s a matter of simply typing the lyrics. But there is a problem. I’m not a native English speaker, so I’m not sure how to properly hyphenate my lyrics. Then Frescobaldi comes to the rescue.

Hyphenation.

Frescobaldi can hyphenate my lyrics, I just need to go to the LilyPond menu, select Lyrics and Hyphenate lyrics text. In the next screen, I need to select the language and voilà. Note that the hyphenation is represented by the

--

notation. But I can add other spaces as well.

Correct hyphenation.

Now let’s compile the new score and see if it works. The output is as we expect:

Happy Birthday TeX.sx - Score 2.

Frescobaldi has a neat integration with Rumor, a realtime monophonic MIDI keyboard to LilyPond converter. According to the website, “it receives MIDI events, quantizes them according to its metronome on the fly and outputs handwritten-like corresponding LilyPond notation. Tempo, meter, key and other parameters can be set via command-line options.”

Rumor.

I tried Rumor with my M-Audio ProKeys88 and it works like a charm. The USB connection was correctly recognized. As you play, the keys are added  to the score. Great stuff.

You can check the generated files: happybirthday.midi and happybirthday.pdf.

Frescobaldi is surely a great editor for LilyPond. The sky is the limit.

:)

4 thoughts

  1. Congratulations on copyright infringement. “Happy Birthday” is in fact still under copyright in USA. And given how the Disney Corporation won’t let the mouse go into the public domain, I don’t think you should expect Happy Birthday to do so either any time soon.

    1. Good news! (4 years later)

      Happy Birthday is now public domain in the US. Actually, the melody was always PD – it was only the lyrics that were protected.

Leave a Reply

Your email address will not be published. Required fields are marked *