caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] types & design advices (musical program)
@ 2002-10-18 11:11 Kontra, Gergely
  2002-10-18 12:29 ` Diego Olivier Fernandez Pons
  0 siblings, 1 reply; 6+ messages in thread
From: Kontra, Gergely @ 2002-10-18 11:11 UTC (permalink / raw)
  To: caml-list

Hi!

I began to play with a little program, which knows about notes.
The first problem, which I face, was the following:
type pitch=[A|Ais|As|H|B|His|C...]
type base=[A|H|C|D|E|F|G]

So when I have who types, where one of them is the superset of the
other.

After that how can I define a pitch type of eg. C?
let p = C will be of the type 'basse'.

The next one is more general:
Assume I want to calculate with notes.
I give the key to the whole stuff (like G major or D minor).
Which I'd like to see is to generate a scale, eg:
scale D Major; (* -->[D;E;Fis;G;A;H;Cis] *)

Of course I want a 'nice' representation, because I want to develope
this little prog.

[Note for "just-programmer-non-musicists":
in a scale, the base notes are successive elements from the type
base. The distance from neightbour notes are 2 2 1 2 2 2 semitones in
the major and 2 1 2 2 1 2 2 in the minor scale. The -is prefix raises
the notes pitch by a semitone, and the -as one lowers it. Stating, that
C D E F G A H is a major scale, one can figure out the distance of the
base notes.]

Gergo

+-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
|         Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |
|  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 9656     |
+-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
.
Magyar php mirror es magyar php dokumentacio: http://hu.php.net

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] types & design advices (musical program)
  2002-10-18 11:11 [Caml-list] types & design advices (musical program) Kontra, Gergely
@ 2002-10-18 12:29 ` Diego Olivier Fernandez Pons
  2002-10-18 14:40   ` Kontra, Gergely
  0 siblings, 1 reply; 6+ messages in thread
From: Diego Olivier Fernandez Pons @ 2002-10-18 12:29 UTC (permalink / raw)
  To: Kontra, Gergely; +Cc: caml-list

    Bonjour,

> I began to play with a little program, which knows about notes.
[...]

> Of course I want a 'nice' representation, because I want to develope
> this little prog.

If you read Haskell, you should look at Haskore (the documentation is
a Haskell litteral program).

http://haskell.cs.yale.edu/haskore/

Paul Hudak wrote a few papers on the subject.

But the best work (in my opinion) has been done by the IRCAM with
their program Open Music (in Lisp). It is much more difficult to
understand.

I also remember a Caml program (for guitar) by a student of ENS Ulm
but I haven't been able to find it again. I will give more information
as soon as I find it.


        Diego Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] types & design advices (musical program)
  2002-10-18 12:29 ` Diego Olivier Fernandez Pons
@ 2002-10-18 14:40   ` Kontra, Gergely
  2002-10-18 15:15     ` Thorsten Ohl
  2002-10-19 14:54     ` Diego Olivier Fernandez Pons
  0 siblings, 2 replies; 6+ messages in thread
From: Kontra, Gergely @ 2002-10-18 14:40 UTC (permalink / raw)
  To: Diego Olivier Fernandez Pons; +Cc: caml-list

>> Of course I want a 'nice' representation, because I want to develope
>> this little prog.
>If you read Haskell, you should look at Haskore (the documentation is

>I also remember a Caml program (for guitar) by a student of ENS Ulm
>but I haven't been able to find it again. I will give more information
>as soon as I find it.

Thx in advance. My future plan is automatic transcription from numeral
bass to 4-voice choir (automatic music-theory example solver). So the
program should good at 'music note arithmetics' in the TONAL (where are
majors and minors) world. I hope you can understand this (many worlds
are not found in the vocabulary).

So given an input like: C: I IV V I, it will produce the corresponding
(c;c e g) (f;c f g) (g;h d g) (c;c e g)

Sorry for this slightly OT, but I hope it will be a handy ocaml progi
(at least for me :))

Gergo

+-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
|         Email: kgergely@mcl.hu,  kgergely@turul.eet.bme.hu          |
|  URL:   turul.eet.bme.hu/~kgergely    Mobile: (+36 20) 356 9656     |
+-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
.
Magyar php mirror es magyar php dokumentacio: http://hu.php.net

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] types & design advices (musical program)
  2002-10-18 14:40   ` Kontra, Gergely
@ 2002-10-18 15:15     ` Thorsten Ohl
  2002-10-19 14:54     ` Diego Olivier Fernandez Pons
  1 sibling, 0 replies; 6+ messages in thread
From: Thorsten Ohl @ 2002-10-18 15:15 UTC (permalink / raw)
  To: Kontra, Gergely; +Cc: Diego Olivier Fernandez Pons, caml-list

Gergo,

> So given an input like: C: I IV V I, it will produce the
> corresponding (c;c e g) (f;c f g) (g;h d g) (c;c e g)

Have a look at

   http://theorie.physik.uni-wuerzburg.de/~ohl/misc/midi-current.tar.gz

and the file midi.ps included therein.  I never finished it, but  it
can interpret files like

-- Body and Soul
-- (Johnny Green)

<2/2> <1/4=85>

<key=Db>
  Ebm7     Bb7(b9)     | Ebm7    Ab7              |
  Db^      Gb7         | Fm7     Eo               |
  Ebm7     Ebm7/Db     | Cf      F7(b9/b13)       |
  Bbm7     {Ebm7 Ab7}  | Db^     Bb(#9/b13)       |

<key=Db>
  Ebm7     Bb7(b9)     | Ebm7    Ab7              |
  Db^      Gb7         | Fm7     Eo               |
  Ebm7     Ebm7/Db     | Cf      F7(b9/b13)       |
  Bbm7     {Ebm7 Ab7}  | Db^     A7               |

<key=D>
  D^       Em7         | F#m7    {Gm7 C7}         |
  F#m7 B7  Em7 A7      | D^                       |

<key=C>
  Dm7      G7          | C       Ebo              |
  Dm7      G7          | C7 Cb7  Bb7 Bb7(b9/b13)

-- $Id: body_and_soul.ch,v 1.3 2000/01/17 02:42:09 ohl Exp $

and `play' them with primitive voicings.

Cheers,
-Thorsten
-- 
Thorsten Ohl, Physics Dept., Wuerzburg Univ. -- ohl@physik.uni-wuerzburg.de
http://theorie.physik.uni-wuerzburg.de/~ohl/     [<=== PGP public key here]
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] types & design advices (musical program)
  2002-10-18 14:40   ` Kontra, Gergely
  2002-10-18 15:15     ` Thorsten Ohl
@ 2002-10-19 14:54     ` Diego Olivier Fernandez Pons
  1 sibling, 0 replies; 6+ messages in thread
From: Diego Olivier Fernandez Pons @ 2002-10-19 14:54 UTC (permalink / raw)
  To: Kontra, Gergely; +Cc: Caml-list

    Bonjour,

I did all my musical studies in France, so I may not use the same
vocabulary than you. If you do not understand what I mean (or think I
misunderstood what you were telling me), just feel free to ask more
explanations.

> Thx in advance. My future plan is automatic transcription from
> numeral bass to 4-voice choir (automatic music-theory example
> solver).

If you mean harmonisation, it is a well known problem and has been
studied in constraint programming world (since it is a declarative
problem). You should look to the Principles and Practice of Constraint
Programming Conference Proceedings (Springer LNCS) (I will give more
information monday)

I remember a research report from LIP6 (in english) explaining how
they did a oriented object constraint solver for music harmonisation
in SmallTalk, but LIP6 server being down, I haven't been able to
localize it.

There is also some papers by Xavier Rodet's and alii at Ircam (they
adapted the well known Lisp constraint programming engine Screamer to
solve music constraints in Open Music)

What you need is a small constraint solver. There is already one
in Caml (FaCiLe) which has been used to handle air traffic control by
the ENAC.

http://www.recherche.enac.fr/opti/facile/

If what you want to do is simple, it should be enougth.

But I am afraid FaCiLe code is not very clean. I read it once because
I wanted to include a simplex algorithme and I gave up. Roughtly it
uses :
- Objects to handle constraints
- A simple constraint repository
- AC6 constraint propagation algorithm
- Finite domains are represented by simply linked lists

If you face a combinatorial explosion problem, you may need to use
smarter tricks (but I really don't think it will be the case unless
you are trying to solve very huge music problems).

First try to define you own goals, constraint propagation rules and
search strategy (see advanced usage in FaCiLe manual). If it still
doesn't improve enought, then you will have to write down your own
constraint solver with smarter algorithms like :
- Diet trees to represent finite domains
- DAC or PC constraint propagation (only an idea, but I don't think
there is much to gain here, unless your problem has special
mathematical properties)
- Heuristics and a priority-search queue for your exploration
algorithms

I have written a prototype general purpose constraint solver (written
over Baire and my graph library) inpired by ALICE (Laurière 78) but it
is still at an experimental stage and will need several months of more
work, so do not hold your breath.

        Diego Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] types & design advices (musical program)
       [not found] <Pine.LNX.4.21.0210210935280.26877-100000@mlabdial.hit.bme.hu>
@ 2002-10-21 12:09 ` Diego Olivier Fernandez Pons
  0 siblings, 0 replies; 6+ messages in thread
From: Diego Olivier Fernandez Pons @ 2002-10-21 12:09 UTC (permalink / raw)
  To: Kontra, Gergely; +Cc: Caml-list

On Mon, 21 Oct 2002, Kontra, Gergely wrote:

> [...]
>
> >If you mean harmonisation, it is a well known problem and has been
> >studied in constraint programming world (since it is a declarative
> >problem).
> [...]
>
> That being the case, Prolog is the right language to implement this
> problem, isn't it? (Well, it doesn't have static type checking...)
>

Pure Prolog won't be of much help, so by Prolog we mean CLP (Prolog
IV, CHIP, etc.)

Prolog has several problems that haven't been yet correctly solved :
- no static type-checking, no type inference
- awfully slow (even compiled Prologs)
- unredable programs if their natural form is not declarative
- no modules (I saw recently a post by Fages in the prolog-list
proposing to develop a Caml-like module system, but for the moment it
hasn't been done), no first-class functions
- very few librairies

In the Lambda Prolog FAQ you can read that Lambda Prolog has :
- polymorphic typing
- modular programming
- abstract data types
- higher order programming

www.cse.psu.edu/~dale/lProlog/faq/faq.html

(There terms do not have always exactly the same meaning that in ML
world)

But Lambda Prolog is not yet a mature language and you still have
serious problems when you need to write non declarative code.

For the moment, the best systems seem to be CLP libraries over an
already existing language, like :
- ILOG Solver (C++)
- Screamer (Lisp)
- FaCiLe (Caml)

The FaCiLe description points out that :

"As FaCiLe is an OCaml library and not "yet another language", the
user benefits from type inference and string typing discipline, high
level of abstraction, modules and objects system, as well as native
code compilation efficiency, garbage collection and replay debugger,
all features of OCaml (among other) that allow to prototype and
experiment quickly : modeling, data processing and interface are
implemented with the same powerful and efficient language"


        Diego Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-21 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-18 11:11 [Caml-list] types & design advices (musical program) Kontra, Gergely
2002-10-18 12:29 ` Diego Olivier Fernandez Pons
2002-10-18 14:40   ` Kontra, Gergely
2002-10-18 15:15     ` Thorsten Ohl
2002-10-19 14:54     ` Diego Olivier Fernandez Pons
     [not found] <Pine.LNX.4.21.0210210935280.26877-100000@mlabdial.hit.bme.hu>
2002-10-21 12:09 ` Diego Olivier Fernandez Pons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).