Software: LilyPond

LilyPond Logo

LilyPond is free music notation software that can typeset music in Clairnote.

On this page:

About LilyPond

LilyPond is free software, runs on GNU/Linux, Mac OS X, and Windows operating systems, and is part of the GNU project.  It is “devoted to producing the highest-quality sheet music possible” and is highly customizable which makes it ideal for creating sheet music in alternative notation systems like Clairnote.

LilyPond has a text-based interface rather than a graphical user interface. LilyPond files are just plain text files written in LilyPond syntax and named using the “.ly” extension. Working with LilyPond is a little like modifying a webpage by editing the HTML text file that web browsers use to display the page.

Frescobaldi is an editor designed specifically for use with LilyPond that offers a lot of really nice features like PDF preview, midi playback, text highlighting, auto-complete, etc. It really helps make LilyPond easier to use and learn.  Highly recommended!

How to Create Clairnote Sheet Music with LilyPond

The process is easy whether you are converting an existing LilyPond file or starting from scratch with a new one.

1. Download and install LilyPond, either version 2.18.2 or the latest 2.19.x development version.

2. Download and install Frescobaldi, the newest version (highly recommended but not required).

3. Download the following file (right-click on the link):

clairnote-code.ly
Released under the GNU General Public License version 3 (html txt).
Development: git repo.

4. Open a LilyPond music file (.ly) in Frescobaldi and add the following line near the top.

\include "clairnote-code.ly"

This includes the clairnote-code.ly file in your LilyPond file, providing additional code that allows LilyPond to render/engrave the file in Clairnote music notation.  Including a file works the same as if you had cut and pasted the contents of one file into another file (see \include).

5. Place the “clairnote-code.ly” file in the same directory as your LilyPond file(s) or somewhere else where LilyPond can access it (see \include).  In Frescobaldi you can designate a directory that contains files that you want to include and then you can always include those files when using Frescobaldi.  To set this up go to Preferences > LilyPond Preferences.

6. Edit your LilyPond file as usual.

7. Engrave the file with LilyPond and it will be rendered in Clairnote music notation.

Note: if you are converting an existing LilyPond file (.ly), make sure it is for LilyPond version 2.18.0 or higher. Look for the \version statement that should be at the top of the file. If it is an earlier version, update the file using convert-ly. (The Mutopia Project offers LilyPond files for free download, but some will need to be updated.)

Clairnote Template Files

You may want to use one of these template files to get started. They are just variations on some of the official LilyPond Template Files.  Note the line \include "clairnote-code.ly" at the top.

By default these templates show Clairnote’s alternative key signatures and accidental signs. If you would rather not use them, just delete the “%” at the beginning of the following line(s) in the template file:

% \remove Accidental_engraver
% \remove Key_engraver

Restore the “%” to show them again. (In a LilyPond file a “%” signals that the rest of the line is a comment, which is ignored when the score is rendered.)

Staves Spanning More Than Two Octaves

The standard Clairnote staff spans two octaves.  For music with a wider pitch range you can optionally use a larger staff with the \cnStaffOctaveSpan command.  For example, you might use \cnStaffOctaveSpan 3 for guitar or \cnStaffOctaveSpan 4 for piano.  This command should be entered in a staff’s \with block or at the very beginning of the music.

To change a staff in the middle of the music – to temporarily extend it up or down an octave to avoid ledger lines – use the commands \cnExtendStaffUp and \cnExtendStaffDown.  Then “unextend” the staff with \cnUnextendStaffUp and \cnUnextendStaffDown.  See the Staff page for more about staves with different octave ranges.

\new Staff \with {
  \cnStaffOctaveSpan 3
} {
  e4 f g a
  \cnExtendStaffUp
  e''' f''' g''' a'''
  \cnUnextendStaffUp
  a g f e
}

Usually you would use different clefs to change the octaves of the staff, but in some cases you might want to have the clef appear at a different octave on the staff. You can move a clef up or down one or more octaves (bringing all the notes with it) with the \cnClefPositionShift command.  The key signature and time signature will also move with the clef.  When combined, all these commands make a wide range of staff and clef configurations possible.

\new Staff \with {
  \cnStaffOctaveSpan 3
  \cnClefPositionShift -1
} {
  e4 f g a
  e''' f''' g''' a'''
  a g f e
}

Clairnote and Traditional Music Notation in the Same File

Sometimes you may want to produce files that contain music in both Clairnote and traditional music notation, say for easy comparison.  Instead of the following which will produce a Clairnote staff:

\new Staff {
  % music goes here...
}

Use this to produce a traditional staff:

\new TradStaff {
  % music goes here...
}

“TradStaff” is the name of a custom staff context.  It tells LilyPond that you want a standard traditional staff instead of a Clairnote staff.  ( \context TradStaff can also be used where you would use \context Staff )

Note Head Styles

Note head shapes can be customized with the \cnNoteheadStyle command. (See discussion in this blog post.) Here are the available styles:

“default”
C major scale in Clairnote music notation with default noteheads
“lilypond”
C major scale in Clairnote music notation with lilypond noteheads
“funksol”
C major scale in Clairnote music notation with funksol noteheads

You can also change the height or width of the note heads by setting the custom context properties cnNoteheadWidthScale and cnNoteheadHeightScale. The note heads are scaled by the amount specified. Here’s how to use these customizations for a given staff.

\new Staff \with {
  % options are "funksol" "lilypond" and "default"
  \cnNoteheadStyle "lilypond"
  cnNoteheadWidthScale = 0.95
  cnNoteheadHeightScale = 0.95
} {
  % music goes here...
}

More Examples and Documentation

To use LilyPond you will need to refer to the LilyPond manuals which are quite comprehensive.  See Sheet Music and More Sheet Music for more examples of music typeset in Clairnote using LilyPond. The LilyPond page of the Music Notation Project Wiki offers some additional information about using LilyPond with alternative notation systems like Clairnote.

Please contact us if you are interested in using LilyPond to create sheet music in Clairnote. If there is a piece of music you would like to see in Clairnote, we can help. See Sheet Music for more details.