Thursday, May 7, 2009

Mullein

Copperbox revision 584.

Last week I got Mullein to print score for the examples in the Haskore distribution. Unfortunately the output was garbage - the LilyPond output looked more like a graphic score than conventional notation.

This is a problem due to Haskore representing durations as absolute times and scores doing arithmetic on them - this is correct for Midi where the duration of an appogiatura is taken from the next next note, but it doesn't work for LilyPond or Abc. Also I found that the metrical splitting code in Mullein isn't perfect - there is a bug somewhere that allows it to make empty beam groups.

I tried to get Mullein to reconstitute durations - its superficially easy to recognize trills and appogiatura in Haskore output. Unfortunately if you also want to consider triplets and n-plets then it becomes very difficult to recognize what an irregular duration might indicate. So that path got abandoned.

After a few false starts, I think I have a solution in string rewriting. If the notes are considered a list it is easy to traverse pairwise looking for combinations where an appogiatura is subtracted from its following note and rewrite them to be a grace and an note with regular duration. The actual implementation is more expressive as you can do traversal with arbitrary depth rather than just pairwise, so other transformations can be implemented. I've written the string rewriting implementation, but I haven't hooked it into the Haskore output yet.

This means that a Haskore score will need both a template doc to control the textual output to LilyPond and a set of rewrite rules to massage the score into something that is metrically digestible - this is quite a user burden. However, I really can't see a viable way of doing the metrical reconstitution automatically.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.