Sunday, October 12, 2008

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?

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.