[chuck-users] input | chuck <read_stdin_and_do_stuff>
v4hn
me at v4hn.de
Tue Jun 1 17:52:08 EDT 2010
good ev'ning everyone,
some time ago I showed ChucK to my girlfriend
and she has been quite enthusiastic about it since then.
So thanks for providing this interpreter!
Well, right now she's coding a automatic composition
tool(in python), which generates some (midi) numbers and
prints them on the screen.
Since this will be an any-time algorithm,
the (actually quite simple) task for the audible back-end
- which (she insists) should be written in ChucK -
is to read the numbers from standard input and generate
matching sounds. So the use-case would look like this:
> ./compose | chuck play_composition.ck
RTFM and RTFS got me to ConsoleInput and FileIO
with the second not being able to connect to stdin.
At the moment the only - quite hacked - way (AFAICS) to
read /anything/ from stdin looks like this:
<<<
ConsoleInput in;
while(true){
in.prompt();
line= in.getLine();
...
}
>>>
This doesn't realize EOFs, but keeps waiting, does it?
And since FileIO provides a readInt() function,
it would be nice to use it in this case...
Is there a way, to read from stdin through some IO-Interface
of ChucK or anything else 'official' - aka not stating
in the source that it's just something hacked?
If not, are there any ideas on implementing this
in Version 1.2.1.4 ?
Well, that's for now,
regards,
v4hn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100601/9dc916e5/attachment.bin>
More information about the chuck-users
mailing list