Re: [Haskell-cafe] music-related problem

2010-07-21 Thread Dean Herington
At 11:53 AM -0700 7/4/10, Michael Mossey wrote: Wondering if I could get some suggestions for coding this problem. A musical document (or score) consists primarily of a list of measures. A measure consists primarily of lists of items. We'll consider only one kind of item: a note. Items have a

Re: [Haskell-cafe] music-related problem

2010-07-05 Thread Michael Mossey
erik flister wrote: Michael Mossey wrote: Regarding my use of Rational, it's because I'm representing *notated* durations or positions in time, which are always fractions of integers. Suppose I give the command to my program to play via midi everything from bar 1 beat 1

[Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
Wondering if I could get some suggestions for coding this problem. A musical document (or score) consists primarily of a list of measures. A measure consists primarily of lists of items. We'll consider only one kind of item: a note. Items have a location within the measure. A note's location

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Henning Thielemann
On Sun, 4 Jul 2010, Michael Mossey wrote: I can solve a simpler problem which is -- Given a note with tieNext set, and a list of notes, find -- the end Loc of the last note in the chain. Only notes -- with the same pitch as 'firstNote' are considered when looking -- for the chain of notes.

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Serguey Zefirov
The thing that is hard for me to understand is how, in a functional paradigm, to update the entire Doc by chasing down every tie and making all necessary updates. This looks like one of graph algorithms. Notes are nodes, ties are arcs. Measures, etc are parts of node label. soundedEnd

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
Henning Thielemann wrote: On Sun, 4 Jul 2010, Michael Mossey wrote: I can solve a simpler problem which is computeSoundedEnd :: Item - [Item] - Loc computeSoundedEnd firstNote notes = compSndEnd (pitch firstNote) notes You will certainly not be able to make use of foldl or foldr, but you

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
Serguey Zefirov wrote: The thing that is hard for me to understand is how, in a functional paradigm, to update the entire Doc by chasing down every tie and making all necessary updates. This looks like one of graph algorithms. Notes are nodes, ties are arcs. Measures, etc are parts of node

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Henning Thielemann
On Sun, 4 Jul 2010, Michael Mossey wrote: Serguey Zefirov wrote: The thing that is hard for me to understand is how, in a functional paradigm, to update the entire Doc by chasing down every tie and making all necessary updates. This looks like one of graph algorithms. Notes are nodes, ties

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Stephen Tetley
If you add Rest as an alternative constructor to Item you should be able to attribute Items with their duration rather than their onset position. For most processing this would simplify things. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Henning Thielemann
On Sun, 4 Jul 2010, Stephen Tetley wrote: If you add Rest as an alternative constructor to Item you should be able to attribute Items with their duration rather than their onset position. For most processing this would simplify things. This is also the way, Haskore organizes its data, but

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Serguey Zefirov
Actually, it would be wise to parametrize Item with computed attributes so that you can clearly distinguish between documents where soundedEnd is set from documents where it is not. Ah, this sounds like something I am looking for... parameterizing Item with the computed attributes. But I am

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
Hi Stephen, Thanks for thinking about this. The problem, though, is that notes can overlap in time. MusicXML solves this by having not just Note and Rest, but Backup and Forward which indicate the current position should be moved before interpreting the following data. I'm trying to make it

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
Henning Thielemann wrote: On Sun, 4 Jul 2010, Michael Mossey wrote: Henning Thielemann wrote: On Sun, 4 Jul 2010, Michael Mossey wrote: I can solve a simpler problem which is computeSoundedEnd :: Item - [Item] - Loc computeSoundedEnd firstNote notes = compSndEnd (pitch firstNote) notes

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Stephen Tetley
On 4 July 2010 21:34, Michael Mossey m...@alumni.caltech.edu wrote: Hi Stephen, Thanks for thinking about this. The problem, though, is that notes can overlap in time. True - Haskore solves this with the Par operator allowing parallel musical lines. ABC and LilyPond have voice overlays - bars

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread erik flister
ties are a presentation-level issue, the underlying (sound) representation is a single note. i suggest Doc = [Note] where Notes have fields for their measure location and duration. then there's no issue with overlapping notes, and start/end times are easy to calculate. ties can be calculated

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
erik flister wrote: ties are a presentation-level issue, the underlying (sound) representation is a single note. i suggest Doc = [Note] where Notes have fields for their measure location and duration. then there's no issue with overlapping notes, and start/end times are easy to

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
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

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread Michael Mossey
erik flister wrote: 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. why isn't this as simple as Erik, I'm learning from your code examples, but I

Re: [Haskell-cafe] music-related problem

2010-07-04 Thread erik flister
I don't understand how this turned into an argument about simplicity. I never said it was complex. i wasn't arguing, just confused about what you were asking cuz i didn't see what wasn't straightforward. so i addressed the straightforward interpretation in order to ask what that was