Thing which seemed very Thingish inside you is quite different when it gets out into the open and has other people looking at it

Friday, August 3, 2012

Creating Music Notation using LiliPond

Lilipond is a music engraving program, which produce high quality music notation and send them into PDF format. One of the most interesting thing you can do using lilipond is, you can use lilipond for your music programming. If you follow their syntax properly you can create music applications very easily.

Lets get a kick start on lilipond.
Before you begin you need to download lilipond depending on your operating system.

For this demostration I am going to show how you can create the popular song "Twinkle Twinkle Little Star" Using lili pond.

There are three main things we need to consider when creating a lili Pond

1. How to create the melody ? (the treble clef notes)
2. How are we going to accompany them? (base notes)
3. Are we going to produce a midi file to our notation.

Creating a melody

In lilipond most of the pitches can be given relatively to a given octave. for example

\relative c {
  \clef bass
  c d e f
  g a b c
  d e f g

Above notes are relative to the middle octave. And if you want to create octaves lower o higher you can use " ,  " (comma)  or " ' ". This is called octave changing mark in lilipond. And also default time signature is 4/4 and default clef is treble clef. Sharp {#} are defined as ("is") and flats (b) are defined as ("es"). For example if you want to create a# then the notation is like "ais". Ok those are the very basic principles of lilipond but if you want to create more complicate notations please refer the use guide.

Lets start our song. Here we are not using relatives we are using standard notation. So I am going to create a lead sheet which only has the treble clef notes and the chords are indicated on top of each bar.

\score {
\chords  {f1 c1 g1 d1:m g1 d1:m f1 c1  }
\new Staff { \time 4/4c'4 c'4 g'4 g'4 a'4 a'4 g'2 f'4 f'4 e'4 e'4 d'4 d'4 c'2 f'4 f'4 e'4 e'4 d'4 d'4 c'2 f'4 f'4 e'4 e'4 d'4 d'4 c'2 }
 \layout { }
\midi { }

Score represents its a lead sheet. And to represent chords  you need the notation "\chords" here you can define what type of chords you want and the duration on that chord.
   f1 - means fmajor and it will last  4 beats (breave).
   d1:m - means its DMinor it will also last 4 beats.
Like wise you can define your codes

By using new Staff you can give music notations such as crochests, minims rest etc depending on the cleff. If you dont have a clef then the default is treble. you can also define time signature, And the duration of the notes are given by numbers. C4 - one beat C2 - two beats , C1- four beats etc.

Lets look at our twinkle twinkle song notation

Creating MIDI

If you want to create a midi file as well you need to put /midi() then it will create a midi file of the song you created.

Creating Piano sheets

Creating piano sheets can also be done similarly. Only difference is you need have two staves other than one.

Example ..

\relative c'' {
  \new PianoStaff <<
    \new Staff { \time 4/4 c4 e8 g8 g4, e4 e}
    \new Staff { \clef bass c,2 e4 g e2 b'4 g}

Creating Fret Sheets.

If you want to create guitar tabs for notation for your songs there is an option to create fretsheets. In order to do that you need to include FretBoards  liberary and give your notation as shown below.


\include ""
\context FretBoards {
  \chordmode {
    c1:m e
\relative c'' {
    \new Staff { \time 4/4 c4 e g g, e2 e} 


No comments:

Post a Comment