dockthepod has asked for the wisdom of the Perl Monks concerning the following question:
So here's the deal:
The program is a curses based drum machine, written in, of course, perl. I'm using the excellent CDK (Curses-DevKit) and have hacked up a pretty slick little matrix interface. The program will pipe it's output to CSound, which will handle the audio part.
Now what happens is you create patterns in a matrix and the program *should* step through it at whatever tempo we are going at, see if a note is going to be played, and if so send a little line to the csound program like:
or whatever.i 1 0 2 3 4
Now this all happens in real time, so i need to have some kind of timer loop that polls the matrix at a regular interval, but doesn't steal all the cycles from the interface.
seems that this is your classic case for a fork with a sleeping child, but my concerns are: will the timing be accurate enough for an audio app ( <3ms or so), and how painful is IPC in perl. i haven't done any IPC programming for quite a while, and would rather avoid it if possible.
is there a magic module that i'm looking for? i looked at Time::HiRes but it didn't seem quite right. (maybe i'm just dumb;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using timers in a music app
by kvale (Monsignor) on Jul 08, 2002 at 03:26 UTC |