Skip to content

Latest commit

 

History

History
522 lines (316 loc) · 16.4 KB

Z-notating-with-lilypond.md

File metadata and controls

522 lines (316 loc) · 16.4 KB

Notating with LilyPond

LilyPond is an open source technology for notating music in plain text files. In this course, we'll cover the fundamentals of music notation in LilyPond.

Tags: none


In this course, you'll learn how to notate music with LilyPond! You can download LilyPond and run the code from this project directly, or you can use LilyBin to play your masterpiece in the browser.

What you'll learn

After taking this course, you'll be able to:

  • Add notes
  • Specify a rhythm
  • Change a time signature
  • Add multiple notes, or chords
  • Change a key signature
  • Use accidentals
  • Specify dynamics

When you're done, you'll be able to answer questions like:

  • How do I notate music for free?
  • How do I make sheet music without a mouse or clicking through a software interface?
  • How can I make version controlled sheet music?
  • Where can I find free sheet music?
  • How do I use LilyPond?
  • What can I use LilyPond for?

We can't wait to see what you create!

What you'll build

We're going to learn how to do some single instrument notation with nothing other than a plain text editor.

68747470733a2f2f6769746d75736963616c2e6769746875622e696f2f6e6f746174696e672d7477696e6b6c652f342d63686f72642e706e67

Prerequisites

  • This course assumes you are able to read sheet music in treble clef.
  • This course assumes you are familiar with the GitHub interface and working with pull requests. If you need a refresher, try Introduction to GitHub.
  • We assume you are comfortable using files and folders.

Projects used

  • LilyPond, software that makes sheet music from plain text files
  • LilyBin, a website where you can run LilyPond for free
  • You'll be able to hear MIDI files output from LilyPond
  • GitHub's file editing interface

Audience

If you are a musician, music teacher, or music student this is a great course for you. If you're wanting to learn how to notate music without needing to use a mouse or click through an interface, this is the best course for you. If you're wanting to learn how to create beautiful, amazing sheet music for free, this is a fantastic way to do that. And if you're a person who loves version control and sheet music, take this course pronto!


Welcome to Notating with LilyPond!

LilyPond is an open source music notation technology. With LilyPond, music can be notated in non-binary files with numbers and symbols, just like code.

In this course, we're going to practice some of the fundamental ways to notate music with LilyPond, like:

  • Pitches
  • Rhythms
  • Time signature
  • Key signature
  • Accidentals
  • Dynamic markings

Before you start this course, you may want to be familiar with a few concepts, like melody and rhythm notation in traditional western music. This course is not about how music is notated - it's about how to notate music with LilyPond.

Notating pitch with LilyPond

LilyPond uses the alphabetical note names to determine pitch. In this pull request, we see:

  c8\mf c g' b
  a a <g d>4
  f4 f e e
  d d c2

Some of these letters, numbers, and symbols represent things related to the notes, and some represent pitches. The letters that represent pitches are:

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

We'll talk about some of the other symbols later on.

Our project right now

We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Step 1: Fix a note

This pull request introduces a file called twinkle-twinkle.ly. This file is the notation of the melody from "Twinkle Twinkle Little Star". But, a few things are wrong. You'll notice that a note is wrong, and a rhythm is wrong - we'll fix the rhythm later. First, correct the note so it matches the traditional melody.

⌨️ Activity: Fix a note

  1. [Edit the twinkle-twinkle.ly file on this branch]({{ editUrl }})
  2. Identify and correct the note in the pattern
  3. Save and commit your changes to this branch

I'll respond when I detect a new commit on this branch.

I wasn't able to find that you added the proper note!

I'm specifically looking for the following line:

  c8\mf c g' g

I'll respond when I detect a new commit on this branch.

Rhythm with LilyPond

Our project right now

We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Rhythm

In LilyPond, rhythm is dictated through symbols. As stated in LilyPond's documentation,

Durations are designated by numbers and dots, and entered as their reciprocal values. For example, a quarter note is entered using a 4 (since it is a 1/4 note), and a half note is entered using a 2 (since it is a 1/2 note). For notes longer than a whole you must use the \longa (a double breve) and \breve commands. Durations as short as 128th notes may be specified. Shorter values are possible, but only as beamed notes.

Rhythm in Twinkle Twinkle

The duration of each note is defined with a number in the same block with the pitches. For twinkle twinkle little star, the long version would look like:

{
  c8\mf c8 g'8 b8
  a8 a8 <g d>4
  f4 f4 e4 e4
  d4 d4 c2
}

If a pitch doesn't have a specific number (duration), it assumes the duration of the pitch before it. You may notice that there isn't a number after every letter (pitch)! In our example, we see:

{
  c8\mf c g' b
  a a <g d>4
  f4 f e e
  d d c2
}

Step 2: Correct the rhythm

If you sing, play, or read this music as it currently is, you will notice that the harmonic rhythm changes in the second bar (the song slows down to half speed). Edit the rhythm to continue the notation pattern from the first measure.

⌨️ Activity: Fix a rhythm

  1. [Edit the twinkle-twinkle.ly file on this branch]({{ editUrl }})
  2. Identify and correct the rhythm in the pattern
  3. Save and commit your changes to this branch

I'll respond when I detect a new commit on this branch.

I wasn't able to find that you added the proper rhythm!

I'm specifically looking for the following line:

  f8 f e e
  d d c4

I'll respond when I detect a new commit on this branch.

Time signatures

Our project right now

Great job! So far, you've edited pitches and rhythms.

We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Time Signatures

Time signatures can be specified before a group of notes by \time followed by the time signature. (Ex: \time 2/4 ).

The main block of notes in our piece currently look like:

\relative c' {
  c8\mf c g' b
  a a <g d>4
  f4 f e e
  d d c2
}

If we were to specify 2/4 time, we would add a line before the notes, but within the block, like this:

\relative c' {
  \time 2/4
  c8\mf c g' b
  a a <g d>4
  f4 f e e
  d d c2
}

See the difference?

Step 3: Change the time signature

Right now, the time signature of this piece is not specified. Let's try out a change and edit it to specify a time signature of 2/4 time. What do you think will happen to the bar lines? 🧐

⌨️ Activity: Change the time signature to 2/4 time

  1. [Edit the twinkle-twinkle.ly file on this branch]({{ editUrl }})
  2. Insert a line before the pitches start to declare a 2/4 time signature
  3. Save and commit your changes to this branch

I'll respond when I detect a new commit on this branch.

I wasn't able to find that you added the proper time signature!

I'm specifically looking for the following line:

... {
  \time 2/4
  
  ...
}

Note: the ellipses (...) are just placeholders for areas that this section doesn't focus on. Do not copy and paste the ellipses into your code.

I'll respond when I detect a new commit on this branch.

Chords with LilyPond

Our project right now

Nice job with the time signature! What do you notice about the barlines?

We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Chords

You may have noticed so far that our example has many instances of only one note, but there is an example of a chord.

Single notes are notated by letters (or letters combined with numbers or other symbols) that are surrounded by spaces, like:

  c8\mf c g' b

Below, you can see that the notes G and D are grouped together by the bracket symbols, < and >:

  a a <g d>4

Step 4: Create a chord

Let's add another chord to the last note of the piece!

⌨️ Activity: Create a chord on the last note with C and the G below it

  1. [Edit the twinkle-twinkle.ly file on this branch]({{ editUrl }})
  2. Edit the last note to be a chord with the notes c and g
  3. Save and commit your changes to this branch

I'll respond when I detect a new commit on this branch.

I wasn't able to find that you added the proper chord!

I'm specifically looking for the following line:

  d d <c g>4

I'll respond when I detect a new commit on this branch.

Key Signatures

Our project right now

Nice work! We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Key signatures on LilyPond

Like with the time signature, the key signature is notated with /key followed by the signature, like \key c \minor. In a file, this would look like:

\relative c' {
  \time 4/4
  \key c \minor
  c8\mf c g' b
  a a <g d>4
  f4 f e e
  d d c2
}

Step 5: Change the key

Let's add some drama and change the key to c minor.

⌨️ Activity: Change the key signature to C minor

  1. [Edit the twinkle-twinkle.ly file on this branch]({{ editUrl }})
  2. Add a line after the time signature to specify c minor as the key for this song
  3. Save and commit your changes to this branch

I'll respond when I detect a new commit on this branch.

I wasn't able to find that you added the proper key signature!

I'm specifically looking for the following line:

... {
  \key c \minor
  
  ...
}

Note: the ellipses (...) are just placeholders for areas that this section doesn't focus on. Do not copy and paste the ellipses into your code.

I'll respond when I detect a new commit on this branch.

Accidentals

Our project right now

We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Accidentals on LilyPond

If you chose to visualize the changes as music notation after you changed the key signature, you may have noticed that the notes affected were automatically notated as naturals.

To change how these notes are visualized, we will add the notation for flats by the notes that we want to actually be flat.

Flats are notated with es after a note, like ces for c♭.

Sharps are notated with is after a note, like cis for c♯.

Naturals (♮) are always assumed.

Step 6: Add an accidental

Let's make the second a in the piece a flat.

⌨️ Activity: Change the key signature to C minor

  1. [Edit the twinkle-twinkle.ly file on this branch]({{ editUrl }})
  2. Edit the second occurrence of the pitch a to be a flat
  3. Save and commit your changes to this branch

I'll respond when I detect a new commit on this branch.

I wasn't able to find that you added the accidentals!

I'm specifically looking for the following line:

  a aes <g d>4

I'll respond when I detect a new commit on this branch.

Dynamics

Our project right now

We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Dynamics on LilyPond

As you may have noticed, musical notation is typically associated with the pitch. Dynamics are included directly after a pitch. You can see this already in our song.

  c8\mf c g' b

As seen on LilyPond's documentation, the available dynamic marks are \ppppp, \pppp, \ppp, \pp, \p, \mp, \mf, \f, \ff, \fff, \ffff, \fffff, \fp, \sf, \sff, \sp, \spp, \sfz, and \rfz.

Step 6: Change the dynamics

⌨️ Activity: Change the dynamic marking from mf to p

  1. [Edit the twinkle-twinkle.ly file on this branch]({{ editUrl }})
  2. Add a dynamic marking of piano, \p, on the first f note
  3. Save and commit your changes to this branch

I'll respond when I detect a new commit on this branch.

I wasn't able to find that you added the accidentals!

I'm specifically looking for the following line:

  f8\p f e e

I'll respond when I detect a new commit on this branch.

Final steps

Our project right now

We have created a version of the song in its current form, and you can listen to it here.

Right now, the compiled piece would look like this:

twinkle twinkle initial version

You can also see and play the file on LilyBin.

Step 8: Approve and merge

You've done it! Go ahead and please approve, then merge this pull request.

⌨️ Activity: Approve and merge

  1. Approve this pull request
  2. Merge this pull request
  3. Delete the branch twinkle-twinkle

I'll respond when you merge this pull request.

What's next?

In this pull request, you'll find the start of a new song. What music will you write next?

Good job, @{{ user.username }}! You're done! We opened [a pull request]({{ prLink }}) with your final notes.

congratulations

What went well

In this course, you learned how to notate music with LilyPond. You learned how to:

  1. Set pitches: c c g g
  2. Change rhythm: c8 g4
  3. Set time signatures: \time 2/4
  4. Create chords: <g d>
  5. Set key signatures: \key c \minor
  6. Add accidentals: a aes
  7. Insert dynamic markings c\mf

What's next?