Re: [Haskell-cafe] Livecoding music in Haskell

2006-11-07 Thread alex
On Tue, 2006-11-07 at 14:29 +0100, Henning Thielemann wrote:
> I also tried to create some music with the SuperCollider wrapper by Rohan
> Drape and the Haskore music package.

That's great, I have used the OSC part of the wrapper but not the rest,
and haven't looked at Haskore yet but have some time tonight and
tomorrow for that...  I would like to hear more about how you got them
to work together though.

> However I had problems with accurate timing. How do you do the timing?

The way I see it there are two big issues - the first is drift and the
second is latency.

A drift error would be something like running at 120.2 bpm instead of
120 bpm.  This isn't a problem until you try playing with other people.
To fix it you have to avoid accumulating errors.  I take a note of the
time at the start of the program (or the last bpm change), then perform
calculations based on what time it *should* be as an offset from that.
The first time measurement you take is the only one you should keep.

Latency I deal with by calculating everything a second or so ahead of
time, and timestamping my OSC packets with times in the future.  Then on
the other side I have some scheduling stuff to trigger sounds at the
right moment, for example in SuperCollider's sclang:

  response = { 
arg time, responder, message; 
if (message[1] == 'on',
  {
SystemClock.sched(time - Date.getDate.rawSeconds,
  {Synth("noisebox",
 [\lgain,message[2] / 100,
  \rgain,message[3] / 100,
  \ts,   message[4] / 100,
  \browndel, message[5] / 100,
  \filter,   message[6],
  \envtype,  message[7]
 ]
); nil;
  };
);
  });
};
o = OSCresponder(nil, '/noise', response);
o.add;

However, as is quite obvious from that screencast, I haven't quite got
around to timestamping Haskell OSC packets yet, I wanted to hear the
latency.  To timestamp a packet you just have to put it in a timestamped
bundle though.

I hope that's useful, if not let me know more about your timing
problems, maybe I can still help.


alex


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Livecoding music in Haskell

2006-11-07 Thread Henning Thielemann

On Mon, 6 Nov 2006, alex wrote:

> I originally did this screencast a while ago for a 6 minute constrained
> talk which explains why it's so short.  This was about my first Haskell
> program, I've progressed some since this experiment and will make a new
> screencast soon.

I also tried to create some music with the SuperCollider wrapper by Rohan
Drape and the Haskore music package. However I had problems with accurate
timing. How do you do the timing?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Livecoding music in Haskell

2006-11-06 Thread alex
On Tue, 2006-11-07 at 01:22 +1100, Donald Bruce Stewart wrote:
> Alex McLean has kindly put up a screencast of him creating 
> *music via live coding in Haskell* !
> http://doc.gold.ac.uk/~ma503am/alex/haskellmusic



Thanks Don!

I originally did this screencast a while ago for a 6 minute constrained
talk which explains why it's so short.  This was about my first Haskell
program, I've progressed some since this experiment and will make a new
screencast soon.

I've been doing similar things with Perl for some years as part of a
band called slub (http://slub.org/), a quick 20 second taster of my Perl
here:
  http://yaxu.org/20/pl.avi
the same thing as flash here:
  http://youtube.com/watch?v=fbefIdbSmD4

It's probably worth pointing out that while slub have had people dancing
to their code on several occasions, these particular screencasts are
really of tech demos rather than music.

cheers,

alex


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Livecoding music in Haskell

2006-11-06 Thread Alfonso Acosta

Absolutely cool I knew about hs-plugins but I didn't know that the
plugin code could be reloaded on the fly. Impressive.

On 11/6/06, Donald Bruce Stewart <[EMAIL PROTECTED]> wrote:

Alex McLean has kindly put up a screencast of him creating
*music via live coding in Haskell* !

http://doc.gold.ac.uk/~ma503am/alex/haskellmusic

And a .avi version of the screencast, playable in mplayer (for those not
flash inclined).

http://yaxu.org/20/hs.avi

The code is running in hs-plugins, and being reloaded on the fly as he
edits the source, changing the rhythms that are produced. More on this
on Alex's blog:

http://doc.gold.ac.uk/~ma503am/alex/

Cool stuff!

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe