Correct, Std.system does block concurrency. Depending on what you're trying
to do there are a few workarounds..
- make any Std.system calls at the beginning of your ChucK script, before
audio has started processing
- run the R scripts in the background using Std.system -- Std.system more
or less directly calls system(3), and it seems as though '&' works, though
I havent personally tried this: https://stackoverflow.com/a/5691067
- use OSC to communicate with a separate long-running script that runs
whatever you need
Spencer
On Thu, Dec 31, 2020 at 3:33 AM federico lopez
Hi, Is the ChucK thread disrupted by the execution time of a Std.system script call?
In the code below, sporking a fast script, e.g. Std.system("sleep 0"), there is no noticeable disruption, but sporking a time consuming version e.g. Std.system("sleep 3") there is a disruption in the other sporks.
I'm trying to call R scripts using ChucK concurrency.
// test code, run with --caution-to-the-wind command-line flag Noise n => Envelope e => dac;
fun void metro() { while(true) { e.keyOn(); 10::ms => now; e.keyOff(); 990::ms => now; <<< now, "samples" >>>; } }
fun void callSystem() { while(true) { Std.system("sleep 0"); // comment this to test //Std.system("sleep 3"); // uncomment this to test 1000::ms => now; } }
spork~ metro(); spork~ callSystem(); while(true){10::ms => now;}
// end test code
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users