[Haskell-cafe] music-related problem

Michael Mossey mpm at alumni.caltech.edu
Sun Jul 4 18:13:23 EDT 2010



erik flister wrote:
>     I am dealing with ties because I am converting a MusicXML document
>     into a more natural form for my purposes. The initial form of the
>     document will have tied notes (as it comes that way from MusicXML),
>     and I want to convert that into a form that makes it possible to
>     ignore ties and see notes as having a single duration.
> 
> 
> but can't you just say that the first note of a tie has the indicated 
> start time and a duration which is the sum of the tied notes?  i don't 
> know musicXML, but i'm not seeing why that would be hard...

That's what I want to do. I'm asking about a good way to write the 
algorithm that traverses the notes and reconstructs the document with the 
correct duration in each note. Actually, I don't want to lose information 
about the original form of the document, so I have separate fields for the 
duration of the graphical single note, and the duration of the tied chain.

Actually, it is better to speak of the end time than the duration, because 
what units do you put duration in? Beats? The time signature could be 
changing measure to measure. MusicXML "position"? The meaning of "one 
position" changes measure to measure and can be different in different 
parts. It can get confusing. So I use this concept of "location":

data Loc = Loc Int Rational   -- measure number and beat within the measure

I.e. measure 1, beat 2
      measure 7, beat 3 1/2

I use Rational so there is no worry about precision of Floats.

Thanks,
Mike





More information about the Haskell-Cafe mailing list