caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Is anyone using caml for music or sound synthesis?
@ 2002-08-08 20:01 Will Benton
  2002-08-08 22:36 ` Oleg
  2002-08-11 20:18 ` Thorsten Ohl
  0 siblings, 2 replies; 10+ messages in thread
From: Will Benton @ 2002-08-08 20:01 UTC (permalink / raw)
  To: caml-list

Hello, just curious to see if anyone is using Caml for music or sound
synthesis.  I have been doing a little work on an algorithmic
composition program, and am interested in hearing about any other
audio-related Caml projects.


thanks,
wb

-- 
Will Benton      | "Die richtige Methode der Philosophie wäre eigentlich 
willb@acm.org    |  die: Nichts zu sagen, als was sich sagen läßt...."
-------------------
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] 10+ messages in thread

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-08 20:01 [Caml-list] Is anyone using caml for music or sound synthesis? Will Benton
@ 2002-08-08 22:36 ` Oleg
  2002-08-09  5:18   ` Travis Bemann
  2002-08-09 13:32   ` Xavier Leroy
  2002-08-11 20:18 ` Thorsten Ohl
  1 sibling, 2 replies; 10+ messages in thread
From: Oleg @ 2002-08-08 22:36 UTC (permalink / raw)
  To: caml-list

On Thursday 08 August 2002 04:01 pm, Will Benton wrote:
> Hello, just curious to see if anyone is using Caml for music or sound
> synthesis.  I have been doing a little work on an algorithmic
> composition program, and am interested in hearing about any other
> audio-related Caml projects.

Speaking of multimedia,  would GC prevent people from writing, say, an mp3 or 
a mpeg player in O'Caml?

Thanks
Oleg
-------------------
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] 10+ messages in thread

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-08 22:36 ` Oleg
@ 2002-08-09  5:18   ` Travis Bemann
  2002-08-09  7:42     ` Nicolas Cannasse
  2002-08-09 13:32   ` Xavier Leroy
  1 sibling, 1 reply; 10+ messages in thread
From: Travis Bemann @ 2002-08-09  5:18 UTC (permalink / raw)
  To: Oleg; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

On Thu, Aug 08, 2002 at 06:36:32PM -0400, Oleg wrote:
> On Thursday 08 August 2002 04:01 pm, Will Benton wrote:
> > Hello, just curious to see if anyone is using Caml for music or sound
> > synthesis.  I have been doing a little work on an algorithmic
> > composition program, and am interested in hearing about any other
> > audio-related Caml projects.
> 
> Speaking of multimedia,  would GC prevent people from writing, say, an mp3 or 
> a mpeg player in O'Caml?

Probably not, because OCaml uses an incremental generational garbage
collector that is rather configurable, so therefore one would probably
be able to configured the garbage collector to limit GC during
playing, combined with generally programming in a fashion that would
avoid allocation (as allocation tends to cause GC to occur, AND
allocation creates new blocks that have to be GCed once they aren't
used anymroe).

-- 
Yes, I know my enemies.
They're the teachers who tell me to fight me.
Compromise, conformity, assimilation, submission, ignorance,
hypocrisy, brutality, the elite.
All of which are American dreams.

              - Rage Against The Machine

[-- Attachment #2: Type: application/pgp-signature, Size: 1349 bytes --]

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

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-09  5:18   ` Travis Bemann
@ 2002-08-09  7:42     ` Nicolas Cannasse
  2002-08-09  8:27       ` Markus Mottl
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Cannasse @ 2002-08-09  7:42 UTC (permalink / raw)
  To: Travis Bemann, Oleg; +Cc: caml-list

> Speaking of multimedia,  would GC prevent people from writing, say, an mp3
or
> a mpeg player in O'Caml?
>
>Probably not, because OCaml uses an incremental generational garbage
>collector that is rather configurable, so therefore one would probably
>be able to configured the garbage collector to limit GC during
>playing, combined with generally programming in a fashion that would
>avoid allocation (as allocation tends to cause GC to occur, AND
>allocation creates new blocks that have to be GCed once they aren't
>used anymroe).

Yes but such algorithms are making a large use of float calculations, and
ocaml float are boxed into a block, so such calcs could trigger multiples
allocations.

Nicolas Cannasse


-------------------
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] 10+ messages in thread

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-09  7:42     ` Nicolas Cannasse
@ 2002-08-09  8:27       ` Markus Mottl
  2002-08-09  8:50         ` William Chesters
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Mottl @ 2002-08-09  8:27 UTC (permalink / raw)
  To: Nicolas Cannasse; +Cc: Travis Bemann, Oleg, caml-list

On Fri, 09 Aug 2002, Nicolas Cannasse wrote:
> Yes but such algorithms are making a large use of float calculations, and
> ocaml float are boxed into a block, so such calcs could trigger multiples
> allocations.

It's true that this can deteriorate performance in the general case,
but note that the compiler performs a fair amount of unboxing (e.g.
float arrays when the compiler can see the float type). This usually makes
numeric code run surprisingly fast in OCaml. If you know the details, you
can most often write your code in such a way that it performs efficiently.
Then it really isn't much worse than C.

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
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] 10+ messages in thread

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-09  8:27       ` Markus Mottl
@ 2002-08-09  8:50         ` William Chesters
  2002-08-09  9:38           ` Oleg
  0 siblings, 1 reply; 10+ messages in thread
From: William Chesters @ 2002-08-09  8:50 UTC (permalink / raw)
  To: caml-list

Markus Mottl writes:
 > On Fri, 09 Aug 2002, Nicolas Cannasse wrote:
 > > Yes but such algorithms are making a large use of float calculations, and
 > > ocaml float are boxed into a block, so such calcs could trigger multiples
 > > allocations.
 > 
 > It's true that this can deteriorate performance in the general case,
 > but note that the compiler performs a fair amount of unboxing (e.g.
 > float arrays when the compiler can see the float type). This usually makes
 > numeric code run surprisingly fast in OCaml. If you know the details, you
 > can most often write your code in such a way that it performs efficiently.
 > Then it really isn't much worse than C.

That's been my experience too.  The main "gotcha" is that when you
write imperative loops you should avoid using "float ref", because
the polymorphism of the 'a ref type prevents float unboxing.  Hence
don't do

  let tot = ref 0. in
  for i = 0 to Array.length a do
    tot := !tot +. a.(i)
  done

but rather

  type floatref = { mutable v: float }

  let tot = { v = 0. } in
  for i = 0 to Array.length a do
    tot.v <- tot.v +. a.(i)
  done

The other thing to remember is that ocaml doesn't do inlining across
compilation boundaries.  If you bear those things in mind, though, it
is fine.  You could probably find cases where ocaml did better than
gcc because of the latter's occasional brainstorms when it comes to
register allocation.
-------------------
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] 10+ messages in thread

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-09  8:50         ` William Chesters
@ 2002-08-09  9:38           ` Oleg
  0 siblings, 0 replies; 10+ messages in thread
From: Oleg @ 2002-08-09  9:38 UTC (permalink / raw)
  To: William Chesters, caml-list

On Friday 09 August 2002 04:50 am, William Chesters wrote:
> The other thing to remember is that ocaml doesn't do inlining across
> compilation boundaries.  

Why not? All dependencies still need to be recompiled when you change the 
module implementation (even when the interface is not changed) [1]

Regards
Oleg
[1] When using ocamlopt, but not ocamlc

-------------------
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] 10+ messages in thread

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-08 22:36 ` Oleg
  2002-08-09  5:18   ` Travis Bemann
@ 2002-08-09 13:32   ` Xavier Leroy
  2002-08-09 17:01     ` Ken Rose
  1 sibling, 1 reply; 10+ messages in thread
From: Xavier Leroy @ 2002-08-09 13:32 UTC (permalink / raw)
  To: Oleg; +Cc: caml-list

> Speaking of multimedia, would GC prevent people from writing, say,
> an mp3 or a mpeg player in O'Caml?

For MP3, not at all.  Consider:
- GC pauses are well below 100ms (more like 10ms, actually)
  (provided the compactor is turned off)
- Sound drivers can usually buffer 0.5-1s of sound.
- MP3 decompression in real-time uses a small fraction of the CPU power.
Ergo, the sound buffer will easily mask the GC pauses.

MPEG video is another story: buffering is much more limited, and CPU
utilization is much higher.  But GC isn't the only source of potential
hiccups: disk accesses are as much of a problem, if not worse.

- Xavier Leroy
-------------------
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] 10+ messages in thread

* Re: [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-09 13:32   ` Xavier Leroy
@ 2002-08-09 17:01     ` Ken Rose
  0 siblings, 0 replies; 10+ messages in thread
From: Ken Rose @ 2002-08-09 17:01 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: Oleg, caml-list

Xavier Leroy wrote:
> 
> > Speaking of multimedia, would GC prevent people from writing, say,
> > an mp3 or a mpeg player in O'Caml?
> 
> For MP3, not at all.  Consider:
> - GC pauses are well below 100ms (more like 10ms, actually)
>   (provided the compactor is turned off)
> - Sound drivers can usually buffer 0.5-1s of sound.
> - MP3 decompression in real-time uses a small fraction of the CPU power.
> Ergo, the sound buffer will easily mask the GC pauses.
> 
> MPEG video is another story: buffering is much more limited, and CPU
> utilization is much higher.  But GC isn't the only source of potential
> hiccups: disk accesses are as much of a problem, if not worse.

It's actually a lot easier to skip video frames than it is to skip audio
samples.  With audio, nearly anything you miss will produce an audible
pop, but it's often possible to skip a video frame or two without it
being very noticable.  MPEG "B" frames are the best candidates, since no
other frames depend on them.  You do have to eat the bitstream, but you
don't need to do any other decode, so you get a chance to get back
ahead.

 - ken
-------------------
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] 10+ messages in thread

* [Caml-list] Is anyone using caml for music or sound synthesis?
  2002-08-08 20:01 [Caml-list] Is anyone using caml for music or sound synthesis? Will Benton
  2002-08-08 22:36 ` Oleg
@ 2002-08-11 20:18 ` Thorsten Ohl
  1 sibling, 0 replies; 10+ messages in thread
From: Thorsten Ohl @ 2002-08-11 20:18 UTC (permalink / raw)
  To: Will Benton; +Cc: caml-list

Will Benton <willb@cs.wisc.edu> writes:

> see if anyone is using Caml for music or sound synthesis.

Some time ago, I've written a MIDI sequencer

  ftp://heplix.ikp.physik.tu-darmstadt.de/pub/ohl/midi/

but didn't have a chance to work with it for quite a while.

> I have been doing a little work on an algorithmic composition
> program

It was my intention to use the sequencer as a backend for such a
project, but was never able to follow up on it.
-- 
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] 10+ messages in thread

end of thread, other threads:[~2002-08-12 13:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-08 20:01 [Caml-list] Is anyone using caml for music or sound synthesis? Will Benton
2002-08-08 22:36 ` Oleg
2002-08-09  5:18   ` Travis Bemann
2002-08-09  7:42     ` Nicolas Cannasse
2002-08-09  8:27       ` Markus Mottl
2002-08-09  8:50         ` William Chesters
2002-08-09  9:38           ` Oleg
2002-08-09 13:32   ` Xavier Leroy
2002-08-09 17:01     ` Ken Rose
2002-08-11 20:18 ` Thorsten Ohl

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).