| Hi everyone,
I've been playing around a bit with csound getting realtime score events
from stdin or from a named pipe (FIFO). This works very well (on linux,
at least) and is quite fun.
But these experiments have got me thinking: I'd like to be able to have
more than one pipe going at once. And I'd like to be able to access the
data written to these pipes within a csound orc at krate.
For instance, let's imagine a hypothetical opcode, "piperead", which
would work something like this:
kamp piperead "pipename"
This would, in effect, read data from the pipe once every ksmps sample
frames, and write the result to kamp.
There's a couple of reasons I would like this: first, it would allow
multiple pipes with different names to control different things in the
orc, which might be nice for keeping track of what's what. More
importantly, it could be used sort of like MIDI "continuous control"
messages, or like xyin, to get streams of realtime control data.
Now, I'm a total novice to unix systems programming; I don't know if a
pipe can even be used in such a fashion. (If data is arriving faster
than the krate, what happens to the extra data?)
And my C is pretty minimal (and rusty at that), so I have no idea how to
implement such a thing anyway.
Also, this would be a highly non-portable opcode... I gather Win32
systems have something like pipes, but Macs don't?
And then there's the issue of what data type is used for the streamed
data (ints? floats? ASCII representations???)
hmmm...
Thoughts anyone?
For those who haven't tried FIFOs with csound: the syntax is:
mkfifo FOO; csound -odevaudio -L ~/FOO blah.orc blah.sco
Now you can send the output of any event-generating program or script to
FOO and csound will play it. The .sco file needs to at least contain a
dummy event to keep csound active for a while, such as:
f0 10000
--
---------------- paul winkler ------------------
slinkP arts: music, sound, illustration, design, etc.
zarmzarm@hotmail.com --or-- slinkp AT ulster DOT net
http://www.ulster.net/~abigoo/ |