LilyPond, Key Signatures, Accidental Signs, Etc.

It has been a productive couple of months on various fronts, especially with ongoing work on LilyPond and TwinNote (adventures in coding in Scheme). Here is a progress report from early 2013.

Key Signatures
I revised TwinNote’s alternative key signatures, and documented them on a new Key Signatures page. They are also now automatically rendered by LilyPond, thanks to some new Scheme code. They are comprehensively illustrated in this PDF file created with LilyPond.

Accidental Signs
I made a new Accidental Signs page that documents TwinNote’s alternative accidental signs, and improved the Scheme code that handles rendering them in LilyPond.  Previously, any time a traditional accidental sign would have appeared, an alternative TwinNote accidental would be drawn instead.  This resulted in unnecessary accidental signs being drawn when notes like D sharp and D natural occurred in the same measure.  This has now been fixed so that TwinNote’s accidental signs are automatically rendered correctly, as shown in the following example:

Fewer accidentals needed in TwinNote music notation

Note Head Positions for Minor 3rds
Notes that make up harmonic intervals of 3 semitones (like minor 3rds) are typically printed on opposite sides of the stem in TwinNote to avoid note collisions and for consistency. (See Intervals.)  In the past, many of these notes would have to be manually tweaked, one at a time, so that they would be rendered correctly in LilyPond.  Now they are automatically placed on the correct side of the stem, and any necessary changes in the position of other notes are also made automatically. (This works for harmonies entered within a single voice in LilyPond, but not for harmonies formed by notes from two or more voices.)

This was my most challenging feat of Scheme coding so far. It entailed figuring out the logic for determining which side of a stem notes should be placed on, and then writing a function in Scheme that implemented a revised version of it.  It is quite a welcome improvement since it removes the most time and labor-intensive aspect of converting existing sheet music files into TwinNote using LilyPond.

Clefs
Clefs are still a work in progress, but I have an initial approach that improves upon just using the traditional clefs with TwinNote. These alternative clefs are now automatically rendered by LilyPond. See the new Clefs page for details.

“Maple Leaf Rag” and “The Easy Winners” by Scott Joplin
How about a couple of piano rags as a taste of the fruits of my labor?  Check them out on the Sheet Music page.  These were quite simple to translate into TwinNote from LilyPond source files available from the Mutopia Project.  The “Maple Leaf Rag” LilyPond file shows how to temporarily extend the TwinNote staff up an octave to avoid ledger lines (see measure 9).

New Note Head Font
The new note head font is starting to make its way through the site.  This includes the new pages mentioned above, the Home page, the Practice page, and all of the Sheet Music files which have been redone using LilyPond and the most recent twinnote-scripts.ly file. (The old sheet music files using the old note head font have been moved to TwinNote Labs.)  I am creating the new illustrations by directly rendering SVG images with LilyPond and then lightly editing them with Inkscape.

Miscellaneous
You can now listen to midi audio versions of the works on the Sheet Music page right in your browser (thanks to HTML5 audio). There are various other minor changes and edits around the site, including a new Names of Notes and Intervals page.  (The basic content of this page used to be on a single page as part of a discussion of how key signatures and accidental signs would work in TwinNote.) I created a simple macro Scheme function to make it simpler to change the staff size (\staffSize). I have started using Frescobaldi which works really well as a text editor for LilyPond.

All of the additions and improvements to the code for typesetting TwinNote with LilyPond can be found in the most current twinnote-scripts.ly file on the Software page.

 

Posted on by Paul Morris | Permalink.