Friday, October 31, 2008

HNotate

Copperbox revision 302.

Absolute pitch is now working for LilyPond output.

HNotate

Copperbox revision 301.

More work towards absolute pitch output for LilyPond. I think all the functionality is now in place, unfortunately it isn't working.

HNotate

Copperbox revision 300.

I've added ErrorT into the NotateMonadT monad stack. During the work to get absolute pitch working for LilyPond output, I've felt that some of the functions really need to return failure rather use a default. Defaulting to middle C for relative output is one - if a score file doesn't have a relative pitch set and it has a directive for relative output, then it seems like a problem to signal to the user for correction rather than do the output regardless.

As for Copperbox being 300, well the code is looking much better as of the last month, maybe by revision 400 HNotate will be ready for release.

Thursday, October 30, 2008

HNotate

Copperbox revision 299.

Minor tidying up, plus a new test case for LilyPond absolute output. It currently fails - getting it working is my next priority.

HNotate

Copperbox revision 298.

I've improved the datatype (and parsers) for parsing the input file as templates. The new datatype guarantees that water and islands alternate (i.e. text source that needs to be preserved - water - must be followed by an output directive - an island - or the end of file). Previously, islands were wrapped in a Maybe type which didn't guarantee anything.

Wednesday, October 29, 2008

HNotate

Copperbox revision 297.

I've cleaned up the BuildNoteList module - the last one rather complicated, I wrote in a fit of enthusiasm after discovering apomorphisms. The latest one uses a nice new typeclass Fits which might suffer the terrible fate of being used for only one type. If I had of written Fits before the new pretty printer I might have used it in that, but the 'fitting' there is much simpler than for the note list (where none-fitting notes must be split across bars with ties) - putting it in the pretty printer now might actually complicate things.

Thinking about yesterdays comment, I'm changing my opinion and I think I was wrong to 'add context' to the annotations and might remove the Abc / LilyPond differentiation rather than extend it. Apropos the 'canonical notelist' I mentioned, it is quite possible that annotation will be best done as a traversal / transformation over the canonical notelist, with different transformer functions for Abc and LilyPond.

Tuesday, October 28, 2008

HNotate

Copperbox revision 296.

Some work on annotations. I've put in a mechanism where Abc annotations are dropped for LilyPond output and vice versa.

This fits with a principle I have for HNotate where you have a canonical notelist but might choose to render it differently (i.e. as Abc or LilyPond), but it needs some more thought. The important thing about annotations is that they let you get to the 'good stuff' in LilyPond (e.g. dynamic markings, string numbering for tablature output etc.). One of the things I want to be able to do is render a tune both as staff notation and guitar tablature, and I don't want the same annotations in both. The annotation mechanism in HNotate will need a finer grained notion of context than just Abc/LilyPond.

HNotate

Copperbox revision 295.

I've removed the dependency on PPrint - while it is a very nice library, my preference is that all of HNotate should rely on the new Document pretty printer not just the Abc and LilyPond outputting.

HNotate

Copperbox revision 294.

The LilyPond back-end now renders with a document based outputter (the print monad is now obsolete).

HNotate

Copperbox revision 293.

Again another instance of deja vu as I've redone the Abc backend. It now uses the new ODoc / Document mini pretty printer and doesn't use the print monad or PPrint.

Importantly, it allows annotations such as up-bow and down-bow markings for Abc. This has never really been working before. The 'combinator' version of the Abc and LilyPond back-ends from a couple of months ago could ouput annotations, but there was no mechanism to specify them in the input notelist.

Adding them to the input notelist was simple in the end - they are just another glyph. But whereas note and rest have obvious, first-order properties (pitch and duration for note, duration for rest), annotations have a single higher-order property - a function of type ODoc -> ODoc that transforms the output of the the preceeding glyph which it annotates during rendering.

Monday, October 27, 2008

HNotate

Copperbox revision 292.

I've added a new module Document which is a limited mini pretty print module. Its salient feature is that it treats concatenation on the empty doc differently to PPrint or HughesPJ - concatenating two empty docs with <+> results in the empty doc - with PPrint it results in a space.

I expect that the print monad will be replaced by simple outputter that uses this module.

Sunday, October 26, 2008

HNotate

Copperbox revision 291.

Added templates missed is last commit.

LilyPond can now print the hijaz key signature - I found an example of changing the Staff.keySignature context in the LilyPond snippet database which is the way to do it.

HNotate

Copperbox revision 290.

Initial support added to handle unusual key signatures - e.g. the approximation of hijaz with Bb Eb F#.

At the moment I don't know how to get these key signatures in (plain) LilyPond, so they only work in Abc.

Saturday, October 25, 2008

HNotate

Copperbox revision 289.

The Abc parsing bug is now fixed.

I'm now back to the functionality of revision 267 or so, which was pretty much a month ago.

HNotate

Copperbox revision 288.

There's a word to describe the 'initial partial measure' - anacrusis.

I've now fixed the anacrusis bug.

HNotate

Copperbox revision 287.

I've cleaned up the logging interface for HNotate monad - resemblance to Hood and the Observe type class are not exactly coincidental.

Outputting unmetered music is working again. Problems still remain with Abc parsing and initial partial bar lengths.

Friday, October 24, 2008

HNotate

Copperbox revision 285.

Deja vu! Another rewrite of the LilyPond and Abc island parsers.

Again the rewrite fells more idiomatic and slightly simpler, the Abc preprocessor is now just 7 lines and building nested expression from the parse result is easier. Unfortunately there is a bad bug in the new Abc parser where I didn't account for line endings terminating fields. The example below parses the key as C M and fails on 2/4 because it has already consumed the meter field designator:

K:C
M:2/4

Wednesday, October 22, 2008

HNotate

Copperbox revision 285.

The Notate monad (WriterT (ReaderT (ReaderT))) is now used everywhere that accesses values in the env (e.g. the default note length, the bar length, or the relative pitch).

I should have done this sometime ago - for one thing it makes the HNotate modules more uniform. Some e.g. the Traversals module, no longer access the env directly as a passed in parameter. Secondly it makes all the non-pure functions log-able - this would have been a big help in the recent debugging.

I've found out (but not yet fixed) why properties properties like partial start are being dropped - the Expression datatype should not allow lists of let bindings - only single let bindings and lists of output directives. Output directives must be inside the right-hand side of a let binding to have effect - with lists of let-bindings they were getting misplaced.

Tuesday, October 21, 2008

HNotate

Copperbox revision 284.

I've re-instated handling of un-metered music in the front end (the \cadenzaOn command in LilyPond, or 'missing' meter field for Abc tunes). The back end needs revision to make it work.

I've added a new set of tests - hopefully these should make it easier to track whether or not features like starting with a partial bar or un-metered music work. As the code is unfortuantely still quite unstable these features have a habit of falling out.

Monday, October 20, 2008

HNotate

Copperbox revision 281.

The preprocessing /parsing bugs are now fixed (I think). The examples in Trees.hs work again - the only problem being that grace notes in the LilyPond output have the wrong duration.

Sunday, October 19, 2008

HNotate

Copperbox revision 281.

LilyPond preprocessing should now be fixed and partial bars work again in LilyPond (though the bar count is wrong in the output).

Abc still has problems with partial measures and there is a newly discovered bug where files with two output directives together don't parse.

Saturday, October 18, 2008

HNotate

Copperbox revision 281.

I've put logging around the most important processing functions in HNotate - and added alternative top-level functions outputAbc_debug and outputLilyPond_debug that do the processing with logging on.

The problems I've seen where Trees.hs doesn't produce any output for LilyPond and other examples drop directives (e.g. partial measures) look like they stem from the preprocessing stage producing bad output. To fix...

HNotate

Copperbox revision 280.

I've put the monads from the OutputMain and DebugWriter modules into the new module Monads and turned them into newtypes adding Reader and Writer instances where appropriate.

This should make them more useful to find out why the main evaluation in OutputMain is losing 'partial measure' information.

Thursday, October 16, 2008

HNotate

Copperbox revision 279.

A Pointless Update!

I've tidied up quite a bit of code putting it into the pointfree (pointless) style.

HNotate

Copperbox revision 278.

Work towards fixing the bug where partial measure directives are missed (adding Pretty print instances for debugging, tidying up code), though no fix yet.

I think I will have to change the monad in OutputMain to be a transformer over writer then I can log what's going on, so I've committed this code now as check-pointed.

Wednesday, October 15, 2008

HNotate

Copperbox revision 277.

Support for partial measures (i.e. where the durations of the elements in the first bar don't add up to the time signature) has been reinstated. Unfortunately it seems to have an error and isn't working in the test.

HNotate

Copperbox revision 276.

I've removed the the out-of-date code from the Abc and LilyPond parsers.

Also sorted out an error where the Abc 'template hole' parser (abcTextChunks) consumed the linefeed at the end of a meta-comment.

HNotate

Copperbox revision 275.

Apropos the last commit, I've rewritten the other parsers now as well. Again they are more idiomatic - they look like other Parsec parsers and don't carry around extra state.

The conversion to HOAS is now done after parsing - this means that the parsed syntax will be available for printing out (debugging). Because so much has been changed a lot of the debugging has been dropped but the useful stuff will be put back in soon. Also a few off the examples don't currently work.

Tuesday, October 14, 2008

HNotate

Copperbox revision 274.

I've rewritten the preprocessors for LilyPond and Abc. They are now much simpler and more idiomatic (i.e. the look like Parsec parsers - the previous ones carried state around and were composed with the >=> operator).

Sunday, October 12, 2008

HNotate

Copperbox revision 273.

As promised I've changed the representation of durations to Data.Rational - I managed without dot but I did need dotn which adds all its dots in one go.

HNotate

Copperbox revision 272.

Changes to the Ratio to Duration conversion functions.

The function approximateDuration should now always produce a result (which may be an approximation - hence its name). The function it replaced representableDuration wasn't guaranteed to.

However I now think that HNotate duration representation should simply be the library Rational type. Previously HNotate was a trying to be a library for building for building music (like PPrint is for Docs). When it was a library, I thought it was important to have a dot function that would add half a duration to a duration. With the current type dot is composable
dot $ dot quarter gives a double dotted quarter (7%16).

This isn't possible if I change to using Rational - dot $ dot quarter would be dot $ (3%8) = (9%16) for an obvious definition of dot.

I'll change to Rational on the next commit, the advantages are no expensive conversion routines just to perform Num functions and a properly debugged base type - but will I miss dot?

HNotate

Copperbox revision 271.

Beaming has been re-implemented for Abc. After my two weeks practice with recursion schemes beam grouping can be done quite nicely with an unfold - if you unfold a list to a list you effectively have lookahead (just like pattern matching and direct recursion of course).

Bar splitting - to get metric subdivisions - is done with an apomorphism which makes it quite short though I can't say the code is very clear.

Saturday, October 11, 2008

HNotate

Copperbox revision 270.

I've added a general mechanism to handle pitch renaming for Abc output. Pitch spellings for all the modes are handled, but supplementary accidentals are still to do.

Supplementary accidentals permit modes with sharps and flats like Klezmer (Ahavoh Rabboh).

Friday, October 10, 2008

HNotate

Copperbox revision 269.

Renamed the NoteList datatypes.

HNotate

Copperbox revision 268.

A new revision after some time...

I've been trying to simplify the translation from EventList (the external format) to NoteList (the internal format) using recursion schemes. Well, unfortunately the new version isn't much simpler but I think its more robust - I spotted that the old version wouldn't handle note lengths greater than a bar length very well.

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.