Kevin Dalley's LilyPond Code

This page documents some earlier important work by Kevin Dalley.  See the main LilyPond wiki page for the most current information.

Kevin Dalley volunteered his time and skills to add features to LilyPond to support chromatic-staff notation systems.  He wrote a set of patches (initially for LilyPond version 2.11.0) that provided for basic chromatic staff functionality. Now most of these patches have been incorporated into Lilypond, as you can see here. (He submitted a patch for internal-ledger-lines but it was never finished. However, it has been superseded by a newer patch by another developer that adds this functionality to LilyPond.)

Mark Hanlon also contributed by updating and maintaining Kevin’s code so that it would continue to work with more recent versions of LilyPond (although it is no longer compatible with newer LilyPond releases). Andrew Wagner set up a git repository for the patches and additional files on to help organize and facilitate future work.

How to Use Dalley’s “” Approach

Most of the content on this page comes from Dalley’s website, and documents his approach to using LilyPond for alternative notation systems — using his “” and template files. There are some non-functioning features (see below).

It is also possible to use LilyPond for alternative notation systems without using Kevin’s “” and template files. See the main LilyPond wiki page for more about working more directly with LilyPond rather than using Dalley’s files. (Both of these approaches are possible because of the code that Dalley contributed to LilyPond.)


Using LilyPond to transnotate music into an alternative notation

Assuming you have already installed LilyPond, here is how you would use it to transnotate music into an alternative notation.

  1. You will need a LilyPond music file (.ly) in standard LilyPond format, in a form similar to The LilyPond website explains how to write such files from scratch. You can also download them from the Mutopia project or other online sources.
  2. You will need a copy of the file which contains the definitions of various alternative music notation systems.
  3. You will also need a template file like this one:
  4. Open the template in any basic text editor and change the following line to refer to your LilyPond music file:\include “”
  5. Next edit the following line near the top of the template so it refers to your desired notation. (See below for a list of notation system names that can be entered here. Each system is defined in the file.)#(define notation-style “6-6-tetragram”)
  6. In the template, change these lines to define how many octaves your music covers.#(define lower-octave -2)
    #(define upper-octave 1)
  7. In the template, the following should be edited so they are appropriate for your file. You can add another voice, or another staff, but should consult the LilyPond documentation for details on this.\VoiceOne
  8. Now open the template file with LilyPond. It should output your music file in the designated alternative notation, except for the following non-functioning features.

Non-Functioning Features

When used with the standard LilyPond application, Dalley’s “” and template files do not currently render ledger lines that are internal to the staff, or different note head shapes. Dalley created a modified version of LilyPond that provided these two features, but they were not incorporated into the official LilyPond application. (See below for more about his patches to LilyPond.)

LilyPond now has support for internal ledger lines, so at some point it would be worth updating Dalley’s files to use this feature (rather than the one he wrote in his custom version of LilyPond). Different note head shapes can also be achieved. (See the main LilyPond wiki page, for more about these features.)  So there is work to be done integrating Dalley’s and template files / code / method with the current version of LilyPond.


Notation Systems

Here is a list of notation names that can be entered in the template in step four above. Each name corresponds to a particular notation system (or “notation-style”). Note that many of these are not fully implemented and are only approximations or first steps towards full support of a given notation system. This list is defined in the file (see below).

6-6-tetragram (6-6 Tetragram by Richard Parncutt)
a-b (Albert Brennink’s Ailler-Brennink notation)
ailler (Johann Ailler’s 4-line notation)
5-line (a basic 5-line chromatic staff)
frix (Grace Frix’s 5-line chromatic staff)
avique (Anne & Bill Collins’ Avique notation)
mirck (Klavar, Mirck version by Jean de Buur)
twinline (Twinline, by Tom Reed)
twinline-2 (Kevin Dalley’s experimental version of Twinline)
beyreuther-untitled (Johannes Beyreuther’s Untitled notation)
isomorph (Isomorph notation by Tadeusz Wojcik)
kevin (an experimental notation by Kevin Dalley)
express (Express Stave notation by John Keller)


Note that your music file may need to be slightly edited beforehand to produce the desired result. For instance, when Dalley transnotated J. S. Bach’s Invention 9 into various notation systems, he had to make a few changes to the original file that he had downloaded from the Mutopia project. For the most part, the note section remained the same. However, the lower staff in the original switched between bass and treble clefs, which he had to modify before transnotating. Here is his slightly modified file for reference:

(Eventually it would be nice to create a simple front-end application with a graphical user interface to handle most of these steps. Then the user would not have to directly edit the template file at all. The user could be presented with a window where they could specify the music file, select the desired notation system, define a few parameters like the number of octaves required, and click a button to transnotate the file with LilyPond.)

Note that Dalley also created a script that allows one to easily generate sheet music in many different notation systems at the same time. This “batch processing” script is not currently documented here, but it can be found on his website.

For Developers

This section has detailed information for programmers and anyone who is interested in what is going on “under the hood” with Dalley’s approach.  Most of the information below originally came from Dalley’s website.

How different alternative notation systems are defined and supported

Supported notation systems are defined in a table that is contained in the file This table makes it possible to quickly transnotate a given music file into any supported notation system. To add support for additional notation systems one would modify the file in order to add more notation systems to the table.

The table contains the following information, which is sufficient to describe a wide range of systems. This information would be needed for any notation system that was to be added.

A numeric list of each staff line position in an octave.
A numeric list of each ledger line position in an octave.
A number stating the position of middle C. (This lets you shift all the pitches of the staff up or down by changing the center pitch to a higher or lower note.)
The numeric distance between C and G, which is where the G clef is positioned.
The number of distinct positions in an octave.
Describes how notes are positioned. Currently either “semitone” or “twinline”.
For notations which have changing noteheads, a list of each notehead for each of the 12 semitones, starting with C.


The notation systems that are currently supported (and included in the table) are listed above. More systems could be easily added, but some systems cannot yet be fully supported since certain features are not yet possible. For example, automatically using black and white note heads for pitch, bold or dotted staff lines, or automatically placing notes on a particular side of the stem.  (These things can be done with LilyPond.  They just have not been integrated with Dalley’s code.  See the main LilyPond wiki page.)

Note that the average user does not have to be able to read or modify the file and its table of notations. Once a notation system has been set up, any user can transnotate music into it by calling it from the template file, as described above.

Note that the file also allows the use of “lower-octave” and “upper-octave” in the template file, see above. This provides the octave number of the lowest octave and highest octave displayed for a continuous staff.


To Do List

This was Dalley’s to do list. They are listed in roughly the order he considered to be most important, with later items in the list less precisely ordered than the earlier items.

  1. Center time-signature-engraver and rests when staff is not at 0.
  2. Investigate non-standard note heads.
    (See, Shape note heads, Note head styles, and The Feta Font.)
  3. Add a LilyPond conversion file which makes clef and key commands do nothing, or at least be consistent with alternative notations.
  4. Add other notation systems with standard note heads.
  5. Allow a notehead to be either hollow or solid (white or black) according to the note’s pitch, for notations that require this.
  6. Add dotted staff lines.
  7. Allow multiple clefs.
  8. Allow for non-standard stems.
  9. Drop octaves which are unused for several measures.
  10. Make conversion between notations easier.

This is an incomplete list of just a few of the items that Dalley completed:

  1. Allow arbitrary center point for staves, which allows other notations similar to 6-6 Tetragram.
  2. Make creation of arbitrary size staves easier. (In progress).
  3. check for 8va and 15ma signs, or some type of register signs for alternative notations.

If you would like to help contribute to this effort, please contact us. See also: Participating in LilyPond development


Patches to LilyPond

Kevin Dalley’s patches for alternative notations that have been committed to LilyPond

An “internal-leger-lines” patch by Dalley was submitted to LilyPond, but was not committed because it still required additional work.  It has now been superseded by code contributed by Piers Titus that added more comprehensive support for customizing ledger lines, see LilyPond. (For the record: Issue 1193: (PATCH) Enhancement: internal leger lines, and here is a separate feature request concerning custom ledger lines: Issue 1292: Enhancement: twelve-notation support and a related email exchange.)

Dalley also worked on shapeLayoutFunction for custom note head shapes. A patch for it was never submitted to LilyPond. Here’s an email exchange about it on the lilypond-user listserv from April 2007.  It and his full modified version of LilyPond can be found here on GitHub.

Since most of Kevin’s patches are now part of LilyPond, his file and template file will work, except for:

  1. The missing “internal-leger-lines” patch (see above).  It should now be possible to revise Kevin’s files so they will work with LilyPond’s custom ledger lines feature.
  2. His shapeLayoutFunction for customizing note head shapes, for notations that require this.
  3. Additional note head symbols, for notations that require them, such as Twinline and TwinNote.

Of course, 2 and 3 are only relevant for systems that use custom note head shapes.