Whole Notes, Accidental Signs, Key Signatures (LilyPond Improvements)

There are some new improvements to the rendering of TwinNote by LilyPond, thanks to a new revision of the twinnote-scripts.ly file.  These include wider note heads for whole notes, better spacing and handling of accidental signs, and improved code for key signatures.

The following image shows how whole notes in TwinNote are now rendered with note heads that are wider than other note heads.  This is similar to whole notes in traditional music notation.

Whole notes in TwinNote music notation

 

Previously the spacing between accidental signs and notes (or other symbols) was the same in TwinNote as it was in traditional music notation, even though TwinNote’s accidental signs are smaller than the traditional sharp and flat symbols.  The spacing values were simply inherited from the traditional symbols without being adjusted at all. Now the spacing values are changed to match the size and shape of TwinNote’s accidental signs.  This means they take up less horizontal space overall, as compared with the traditional symbols.  Also, when space allows they will be aligned vertically, as one might expect.

Improved accidental spacing in TwinNote music Notation

 

One of the more significant changes involves how accidentals are customized.  Previously the traditional accidental signs rendered by LilyPond would be replaced with their TwinNote versions, or omitted if they were not needed in TwinNote.  In general TwinNote requires fewer accidental signs than traditional notation, especially in cases like the one shown in this image:

Fewer accidental signs are needed in TwinNote

However, there are very rare cases that are the converse of the example shown above, where an accidental is needed in TwinNote but is not needed in traditional notation.  These rare cases are when enharmonically equivalent notes that have different “spellings” occur in the same measure.  An example would be an F flat followed by an E natural, as shown in the next image.

Accidentals for enharmonic equivalents in TwinNote music notation

 

These cases posed a technical problem because of constraints in the way that one can modify LilyPond’s output — there is no way to override the symbol for an accidental sign that is not there in the first place.  So previously, in these rare cases, some accidental signs that were needed were simply not shown.

Luckily, it turns out that LilyPond offers different modes for determining when to display accidental signs, and one of these is a dodecaphonic mode that displays an accidental in front of every note.  This was a practice used by some composers of atonal/chromatic/dodecaphonic music in the early twentieth century in order to escape or at least minimize the tonal/diatonic bias built into traditional music notation.  Basically it was “an attempt to abolish the hierarchy between natural and non-natural notes” as the LilyPond documentation puts it.

Using this dodecaphonic mode for all TwinNote staves makes it possible to render a custom accidental sign in front of any note when it is needed, and simply omit the sign  when it is not.  The revised code determines if a note is an accidental or not, whether it needs an accidental sign in TwinNote, and if so, what kind of sign to use.

The image above shows the results.  Previously none of the natural signs would be rendered in front of the 3rd note in each measure on the TwinNote staff.  Now they are shown, making it possible to differentiate between these different spellings of enharmonically equivalent notes.

Such cases are quite rare, but now they will be handled correctly if and when they occur.  Of course the TwinNote staff does a better job than the traditional staff in conveying that such enharmonically equivalent notes will sound the same (or very similar), even if they have a different name or “spelling.”

Finally, some improvements were made to the code for handling key signatures.  These included improving spacing in some cases, and also making the code more efficient. It turns out that LilyPond’s key signature engraver code, and thus also TwinNote’s custom key signature code, is called every measure, since a key signature may need to be printed in any given measure.  So the new code stores key signature symbols when they are first created and then re-uses them rather than (re-)creating them each time the code is called (i.e. every measure).  This more efficient approach should make a difference in how long it takes to render longer scores.

From a user’s perspective these changes are rather minor refinements when compared with many of the previous improvements. This reflects the increasing maturity of the twinnote-scripts.ly code.  As I mentioned in my last post, it is satisfying to reach the point where there is less that remains to be done compared with what has already been accomplished. As always, the new twinnote-scripts.ly file is available for download from the Software page.

Posted on by Paul Morris | Permalink.

2 thoughts on “Whole Notes, Accidental Signs, Key Signatures (LilyPond Improvements)

  1. Nice work. The bigger whole notes make sense. I’ve always assumed traditional notation uses bigger whole notes so that they aren’t overlooked as easily, because their lack of stems might make them less noticeable than other notes otherwise.

    The accidental spacing is a good tweak. Those rare cases you mention are rare indeed! They might happen more often in microtonal music (which is itself rare), in which the “enharmonic equivalents” are actually different pitches.

  2. Thanks Doug! Good point about microtonal music, and I agree about the need to make whole notes more prominent. Wider whole notes might also be needed if you had say a triad where the middle note was a whole note and the other two notes were quarter notes. The different note heads would allow you to distinguish the different durations. I suppose that would be fairly rare, and you could just work around it with tied notes. In any case I think they it is more aesthetically pleasing to give them more weight in this way.

Comments are closed.