[Haskell-cafe] When the unknown is unknown

Martin Drautzburg Martin.Drautzburg at web.de
Wed Jun 23 16:50:16 EDT 2010

Hello all,

I am currently playing with Paul Hudak's Euterpea (a music program, formely 
called Haskore) and I am trying to teach it about rhythm.

I said that a rhythm is a series of Moments (or Beats), each expressed as 
fractions of a bar. But each Moment also has volume. So I could model rhythm 
as Pairs of (Moment, Volume). However I certanly do not want to specify both 
the Moments and the Volume, but rather compute one from the other.

Often the Moments are known and I need to compute the Volumes, but this is not 
always the case. I might as well start with the volume and compute the 
moments. The latter would be particularly interesting when trying to find 
rhythms which are suitable for certain lyrics. In that case I must even be 
prepared to find more than one series-of-moments which "fit" to the given 

There are countless other problems like this, e.g. when trying to match 
harmony, melody and tension. In that case I even have three variables and I 
may want to specify tension first, then melody and have the harmony computed. 

At first glance this looks like a Prolog-like problem to me. I could say that 
certain things are always true for [(Moment, Volume)] and let an inference 
engine figure out the options which are still in consideration.

From which angle would you approach problems like this? Should I get my hands 
on a prolog-in-haskel implementation (which indeed seems to exist)? Or should 
I roll my own poor-man's prolog? Or is this a 
constraint-satisfaction-problem? Or is there even a more straight-forward 
more haskellish pattern, which solves such problems?

Any pointers would be much appreciated.


More information about the Haskell-Cafe mailing list