Wednesday, December 31, 2008

OpenVG binding

Copperbox revision 389.

Added Consts.hsc which all the incorporates all the enums in the OpenVG standard.

Sunday, December 28, 2008

OpenVG and ZParse

Copperbox revision 388.

I'm taking a break for HNotate for a bit. I've worked out how to simplify the document building code (principally the TemplateDatatypes module), but that means redoing the parsers again so they handle island parsing better (and don't build the parse tree with continuations). I got rather frustrated with Parsec's lexer handling - not that it isn't capable just that I was probably trying to solve my problem in the wrong way - so I started another parser combinator library ZParse. Applicative and Alternative now encompass much of the work need for basic parsing, so writing the usual combinators was easy, but handling tokens is tricky so maybe I'll go back to Parsec.

For a change I've started on a Haskell binding to OpenVG - the vector graphics API. I've spent the whole day defining constants and I've still got half of the marshallers to do, never mind unmarshalling. As this is a baby step compared to the involved stuff of calling functions through the FFI, it looks like the binding will be a much bigger job than I thought.

Tuesday, December 23, 2008

Bala and TabApp

Copperbox revision 387.

Corrected compiler warnings in Bala and TabApp.

ZMidi

Copperbox revision 386.

Corrections to get rid of -Wall compiler warnings.

HNotate, Bala and TabApp

Copperbox revision 385.

HNotate - I've changed the debug interface to have just DebugOn or DebugOff rather than levels. The early versions of the BuildNoteList module were so complicated that I needed a large amount of logging just to check they were working. Now with the Fits module and segmenting functions, I'm much more confident in BuildNoteList so no longer need so to deal with so much logging.

Changes have been cascaded to Bala and TabApp as HNotate's interface has changed.

Monday, December 22, 2008

HNotate

Copperbox revision 384.

I've associated AnnoEval with a named element within a system, rather than a single global AnnoEval. This means that we can have different annotation schemes within the same output document. The StringNumberScale example takes advantage of this to output both staff and tab notation.

HNotate

Copperbox revision 383.

Added a worked example of annotation - string numbering for LilyPond output. Also I've implemented a proper defaultMeterPattern function, that calculates a meter pattern for a given time signature. Previously this function was a stub.

HNotate

Copperbox revision 382.

HNotate has a new annotation mechanism. Annotations were previously just transfomers applied the pretty printed elements and atoms (i.e. they were functions of type ODoc -> ODoc). This had a serious problem - when adding multiple annotations you had to be very careful about the order of application of the transformer functions.

Now annotations are fully typed values (albeit wrapped up into a generic list with Data.Typeable). To print them, the user must supply a AnnoEval structure which contains three functions for applying annotations at three different levels in the syntax tree.

With revision 382 the mechanism to do this is in place but there aren't any example annotations and the interface to run HNotate in OutputMain hasn't been changed to be parameteric on AnnoEval.

Sunday, December 21, 2008

HNotate, Bala and ZMidi

Copperbox revision 381.

I've had not internet connection since Wednesday so this is a bigger update than usual.

HNotate - I've added a beam grouping level in the abstract syntax tree. Adding beam grouping into the AST has made the beam handling code better - previously beaming was essentially lexical - when the outputting functions saw beam_start or beam_end in the sequence of notes, rests and mark, the functions changed their behaviour accordingly (they were stateful). Now that beam grouping is in the AST the outputting functions are simpler as they can use normal top-down traversal strategies.

Bala and ZMidi - I've added -Wall annotations to the files.

Wednesday, December 17, 2008

GreyFold

Copperbox revision 380.

I've added another module to GreyFold - SynthethicFolds. These are the folds that can be defined in terms of foldl or foldr - countfold, statefold, double accumulator fold - all they actually do is partition the summary value in some way, so they can be defined on Foldable types.

Also, I've added mergesort to the Data.Sequence compatibility functions.

Tuesday, December 16, 2008

GreyFold

Copperbox revision 379.

I've added a new library GreyFold which collects together all the folds, recursion schemes and utility functions for Data.Sequence from HNotate. I called it GreyFold because a lot of the functions seemed to be in the grey area between utility and curios.

(Note to me - I still need to add the mergesort for Data.Sequence from ZMidi).

Sunday, December 14, 2008

HNotate

Copperbox revision 378.

Midi output is dropped (again) from HNotate. As noted in my last post, I think trying to do Midi inside HNotate has been lead to some dubious generalizations of code that was satisfactory for Abc and LilyPond. Also, I've tidied up OutputMain quite a bit as it is now has to do less do.

HNotate

Copperbox revision 377.

Work to add templates for Midi output, so Midi would work like LilyPond or Abc...

However, its probably Midi's swan song as far as HNotate goes. I think I can say that having HNotate work with both Abc and LilyPond has improved HNotate. While there is still plenty of convoluted code in HNotate, targeting both Abc and LilyPond has made me look for better solutions than I think I would have found just targeting LilyPond. But, I believe that adding Midi support has made HNotate worse - to support Midi it feels like I've dubiously generalized some parts of HNotate that supported Abc and HNotate well. So after this revision I think Midi's time is up.

I'd like to add a notelist backend at some point that can easily be parsed and turned into Midi (something like one of the Humdrum representations), but a representation that is still textual so better matches what HNotate is good at.

Saturday, December 13, 2008

HNotate and Bala

Copperbox revision 376.

A lot of changes to the hand-built document parts of HNotate. I'm trying to make them use more of the machinery that the documents parsed with island parses use.

The doc combinators - in DocLilyPond and DocAbc - are now quite a bit simpler and the operation of plugging documents is better defined. There is still quite a lot of work to simplify OutputMain though, and I've disabled HNotate's Midi output for the time being.

Changes have been cascaded to Bala so that the examples will compile.

Thursday, December 11, 2008

HNotate

Copperbox revision 375.

I've changed the update functions in the RhythmicValue and PitchValue type classes so they are of the form b -> a -> a rather than a -> b -> a.

I ended up changing the function name from modifyValue to updateValue as well. Changes have been cascaded to Bala.

HNotate

Copperbox revision 374.

I've changed the traversals module to just use shape-contents traversals rather than WrappedMonad ones. As they were both doing the same thing it is easier just to have one.

Wednesday, December 10, 2008

HNotate

Copperbox revision 373.

Some work on propagating annotations to chords and tuplets. Unfortunately I've decided I don't like how I'm doing it, so annotations as a whole are due for a revision.

Sunday, December 7, 2008

HNotate, Bala and TabApp

Copperbox revision 372.

Some rework on TabApp and minor changes to Bala and HNotate.

I thought I'd look at getting TabApp to work, as it will be something to stretch HNotate with. It has already show a limitation in HNotate - individual notes within chords should have annotations so they can have string-numbers (the same goes for tuplets).

I've split TabApp into two parts, one LpTab is a simple tab to LilyPond converter, the other is new code but still called TabApp. There is a rationale for having two versions. LpTab has a very strict parser, it will abort on a parse error. Guitar tab files only have a loose specification as they're intended for human reading - with LpTab I'm trying to find out a good subset that corresponds to LilyPond's tab capabilities. For TabApp I want the parser to be a bit looser, it should be able to at least run on tabs from the wild whether or not it can turn them into good output.

Saturday, December 6, 2008

HNotate

Copperbox revision 371.

I've simplified the code for beam grouping - rather than an unfold with various case distinctions, it is much shorter as a groupBy: all notes and chords under a quarter get groupedBy within their metrical cell. Then a simple fold joins the metrical cells back together to reform the bar.

Friday, December 5, 2008

HNotate

Copperbox revision 370.

I've reimplemented beam segmentation with a function regiment that's based on Fits.

Whereas the the function segment breaks elements to pack them exactly into the division, regiment doesn't break elements instead they go into the next segment but the 'remaining width' is correctly tracked. This is exactly what beam grouping needs.

HNotate and Bala

Copperbox revision 369.

I've tidied up the Fits type class and made it handle hyphenation better. Previously any split element of type Atom would be hyphenated with a tie. This meant rests and spacer rests were being tied as well as notes, also chords weren't tied as their type is Grouping (this data type still needs a better name) not Atom. Looking at Conal Elliott's nice Segment type class I realized I could get rid of the Fit data type within the Fits module and just use the Fits type class. Actually I could have used Conal's class, but for HNotate its convenient to have the hyphenate function in the same place as the split function.

Bala has also been updated to take the changes to Fits.

HNotate

Copperbox revision 368.

I've removed the bar number label from the Block data type (Block represents either a single bar or a bar with overlays). Bar numbering can easily be synthesized when needed.

Thursday, December 4, 2008

HNotate and Bala

Copperbox revision 367.

In HNotate, I've sorted out the typeclass PitchContent and put all the functions on Data.Sequence in one module (stranspose, sfilter, recursion schemes...). This has cascaded quite a few changes to Bala, which has been updated and the demos run again.

HNotate

Copperbox revision 366.

I've updated the Haskore interface to HNotate so that it compiles at least. As Haskore takes quite a different view of music to HNotate (i.e. the information it carries around in its data structures is quite different) I'm still not sure if HNotate will ever be able to generate reasonable scores from Haskore.

HNotate

Copperbox revision 365.

I've redone the BuildNoteList module. It's now much simpler - there aren't the special datatypes that the previous version had to track position. The only complicated bit is a recursive step inside the function defork that uses to accumulators rather than one.

Tuesday, December 2, 2008

HNotate

Copperbox revision 364.

I've implemented the LilyPond relative traversal* as a focused shape-contents traversal. The code size is about the same as the WrappedMonad version of this traversal. The code seems an improvement (in terms of clarity, readability, ...). However this may solely be 'second attempt advantage' - if I had done another WrappedMonad version that would no doubt be an improvement. So for the time being both versions are in the code base.

Traversals are still HNotate's weak point, as the last post and commit fixing a tuplet bug highlighted. A large part of this is due to the main containers / data structures not being directly functorial - where list [a] is a one layer container over its element type, HNotate often has two layer containers Seq (Seq a) and also carries around extra information (e.g. bar numbers) that can't be accessed functorially (i.e. bar numbers are invisible to fmap, foldable or traverse).


* The traversal changes both pitch and duration to be relative to the preceding note

HNotate

Copperbox revision 363.

I've fixed a bug where tuplets were getting assigned zero_duration if they had the same total duration as the preceding note. LilyPond uses a scheme where if a note has the same duration as the last one then the duration can be omitted - HNotate can normally use this, but because triplets have synthesized durations it was causing problems. Now tuplets always print the unit duration with the first member tuplet.

Monday, December 1, 2008

HNotate

Copperbox revision 362.

Improved the module Duration to get rid of compiler warnings.

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.