Saturday, September 27, 2008

HNotate

Copperbox revision 267.

Some tidying up - I've moved the enharmonic spelling functions out of the pitch module and deleted the 'builder' modules for LilyPond and Abc.

The two builder modules were probably bigger than the rest of HNotate - I'm almost sad to see them go as they had so much work put into them. I probably had to do all that work to come up with the ah-ha that showed me they were unnecessary, but it would have been nice to have gone down a fruitful path from the beginning.

Friday, September 26, 2008

HNotate

Copperbox revision 266.

I've added the first pages of a manual for HNotate - naturally it is written in literate Haskell, lhs2TeX is main design inspiration for HNotate.

HNotate

Copperbox revision 265.

I've reinstated the debugging code that prints the score after the first translation step (it was disabled in the last commit).

Thursday, September 25, 2008

HNotate

Copperbox revision 264.

A major update - I've now made both the Abc and LilyPond parsers do the 'island parsing' in a preprocessing step. This has made them much simpler - and both can use the exprView parser which parses the shape of a post-processed view .

Also the evaluation of a post-processed view has been simplified in OutputMain. Post-processed LilyPond and Abc are both represented as a very simple datatype Expr which has a handy use of higher-order abstract syntax to modify the environment as Expr is being traversed.

Wednesday, September 24, 2008

HNotate

Copperbox revision 263.

Added a preprocessor to handle the island parsing of LilyPond files (Abc to do).

I haven't replaced the original parser yet as it has got rather tangled in my local workspace.

Saturday, September 20, 2008

HNotate

Copperbox revision 262.

The LilyPond backend now uses the print monad. It doesn't yet handle beaming - I'll have think about how to handle LilyPond's mixfix grouping where a triplet is - c [e g].

HNotate

Copperbox revision 261.

The Abc backend now uses a new output scheme which allows it do beaming.

Previously the output built a pretty printed Doc that was wrapped up with a phantom type layer. With the change to using score file templates there is not so much need for this phantom typed doc - HNotate doesn't export the phantom typed doc to users so the responsibility to generate correct output is entirely internal. And it had always felt very heavyweight, as my struggles to get it to do what I wanted showed.

So now its being replaced by a State monad that works like the Writer monad, but with some quirks - the output can't be an instance of Monoid because the append operation has to be controllable on the fly. This is how Abc beaming works - at the start of the beam group the append operator is changed from (<+>) spaced, to (<>) no space then reverted to spaced at the end of the beam.

The next step is to change the LilyPond backend, which will hopefully corroborate the advantages of the new scheme.

Friday, September 19, 2008

HNotate

Copperbox revision 260.

I've revised the ToNoteList module of HNotate and it now brackets notes into groups when the consecutive durations are less than a quarter - then they can be beamed in the output.

Unfortunately, neither the Abc or LilyPond backends support beaming yet. LilyPond brackets a beam group after the first note so a triplet would be c [e g], whereas HNotate has them [c e g] - clearly a translation would be quite easy for this one. Abc is more tricky - beaming is indicated by the absence of a space separator between notes. To get this right I will probably have to change the Abc pretty print combinators.

Wednesday, September 17, 2008

HNotate

Copperbox revision 259.

Abc output now has durations.

HNotate

Copperbox revision 258.

I've added an initial mechanism for pitch name naturalization to the Abc output so that accidentals aren't printed when they are already accounted for by the key signature. So far this is only done for two keys as I'm not sure whether to enumerate all the keys 'by hand' or take some of the interval code from Bala and construct the pitch spellings from interval patterns.

The Abc output still doesn't calculate durations properly as this is more involved than with LilyPond, that looks like the next thing to do.

Tuesday, September 16, 2008

HNotate

Copperbox revision 257.

I've updated the traversals including a composed traversal for LilyPond. This has neatened up the code somewhat.

Monday, September 15, 2008

HNotate

Copperbox revision 256.

I've started work on sorting out the traversals. I've tidied up the existing ones, but haven't yet composed them together (currently each traversal is run in a separate pass). Ideally there should be a LilyPond pass or an Abc pass that fuses all the appropriate traversals together.

Sunday, September 14, 2008

HNotate

Copperbox revision 255.

Major changes to the internal note list representation and the EventList interface.

The external event list and internal note list were previously parametric - the internal note list ScNoteList which is really a tree that could have the type of its leaves changed (as Abc glyphs seemed different to LilyPond ones). The external event list was parametric through the type class Event - anything that implemented Event could be rendered.

I've now changed this - the new version is more like the pretty printing libraries PPrint and Text.PrettyPrint.HughesPJ. There is a simple internal format (ScNoteList) plus a functional interface to build it (note, chord, gracenotes etc).

Unfortunately some of the new code is quite messy and not all of the examples that used to work still do (the LilyPond Bulgarian6 example works properly). While the changes have simplified HNotate's internals, there is more work to do to unify the traversals and add metrical grouping so that notes that should be beamed will get beamed.

Friday, September 12, 2008

HNotate

Copperbox revision 254.

More work to handle unmetered music - the changes are minor, I haven't yet decided if I need to change the intermediate score representation.

HNotate

Copperbox revision 253.

Some work towards implementing unmetered music (aka LilyPond's \cadenzaOn and \cadenzaOff). But it is incomplete as I'm thinking that the intermediate score format might be better of tracking some 'inline marks' like barnumber check (currently they are generated in the final render process). If I do add a mechanism for inline marks they should be able to handle ties and beam grouping as well.

Thursday, September 11, 2008

HNotate

Copperbox revision 252.

I've added a rudimentary interface to Haskore. One of the simplest examples in Haskore produces equivalent output (t251), but more complex examples produce musical gibberish (Children's Song 6, Stars and Stripes Forever).

Working with Haskore's trills is going to be difficult as they are rendered directly to notes (with short durations). In Abc and LilyPond grace notes, which would accommodate trills, are a special case in that they aren't counted in a bars duration.

Tuesday, September 9, 2008

HNotate

Copperbox revision 251.

I've added bar number checking to the LilyPond and Abc output.

This certainly makes the generated scores much more readable, but currently the check is printed every bar. It would be better to make this configurable, but this would mean putting the back ends back into a reader monad.

HNotate

Copperbox revision 250.

The intermediate note list (before it is translated to LilyPond) can now be printed for debugging.

This is making the type signatures in OutputMain rather overgrown, but I'll probably try to add support for generating 'spacer lists' first (see the LilyPond manual section 9.2.2 Creating contexts - the music / arts example). If I tidy up OutputMain first I'll only have to change it again to support spacer lists.

Monday, September 8, 2008

HNotate

Copperbox revision 249.

Some tidying up of OutputMain the score generation module.

It's still deficient - the evaluation that builds 'plugs' (indexed documents to fill holes in templates) has the generation strategy hard-wired. The generation performs two steps - render to a common format (the score data types) then output to a either LilyPond or Abc. I want it to be able to just render to the common score format for debugging purposes, but to do that will mean so rethinking of the code.

Saturday, September 6, 2008

HNotate

Copperbox revision 248.

Significant improvements to the LilyPond and Abc rendering.

Bulgarian6 now outputs valid LilyPond producing the same score as the hand coded version. The Abc output still has some flaws - one is that accidentals are printed when they shouldn't be. Another obvious one is that the beaming is wrong, I'm not sure how to get round this - maybe beaming information will need to be supplied in the input note lists.

There are some other problems for both Abc and LilyPond - principally that the generated output is not as nice as it could be making it hard to read. Both formats should only render a fixed number of measures on one line (possibly just one) and LilyPond should output barlines even though they aren't necessary.

Thursday, September 4, 2008

HNotate

Copperbox revision 247.

I've improved the Abc island parser and the test template now parses correctly.

HNotate

Copperbox revision 246.

Abc output has been re-instated although like LilyPond output it isn't working correctly yet.

HNotate

Copperbox revision 245.

More reworking on the HNotate code. I've changed the some of the data types (and their names) now that HNotate doesn't try to represent full scores[1]. The Trees.hs example now runs but generates errors in the LilyPond output, clearly I've still a lot do do for LilyPond, alongside restoring Midi and Abc output.

[1] Scores are defined in the LilyPond template files HNotate just injects note lists into the template holes.

HNotate

Copperbox revision 244.

I've added a new example Scales.hs. Its a very simple one - I added it to have something else working before I put some effort into getting Trees.hs to work again (which is more complicated).

Wednesday, September 3, 2008

HNotate

Copperbox revisions 242 & 243.

Major restructure of HNotate - with revision 242 I deleted both the HNotate and HNotateAlt directories. With revision 243 I added the latest HNotate code which has is the HNotateAlt code but has substantially different file structure.

The LilyPond 'bulgarian6' example in HNotate/Examples runs, which is promising but there are an awful lot of hacks to make it work. A lot of the data structures have been changed to work with new template based generation scheme, but they really need rethinking.

Monday, September 1, 2008

HNotate

Copperbox revision 241.

HNotate alt - I've added extracting parsers for LilyPond and Abc.

Extracting parsers are island parsers that parse a file and extract some facts but leave much of the content uninterpreted. As they are much simpler than a full parser, hopefully they will always succeed rather than throw a parse error.

My current thinking is that output from HNotate should be limited to just note sequences (after all the input is a just a note list). Larger structure - multiple staffs, headers, and the like - should be specified in LilyPond or Abc files where it can be done more conveniently. Meta-comments in the LilyPond or Abc files can indicate template holes where HNotate will output note sequences.

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.