On Thu, Dec 31, 2020 at 6:42 PM Spencer Salazar <spencer.sala...@gmail.com> wrote:
> Correct, Std.system does block concurrency. Depending on what you're > trying to do there are a few workarounds.. > Hi Spencer, thanks for your response > > - make any Std.system calls at the beginning of your ChucK script, before > audio has started processing > Although it is a good solution, it is not usable in my case, In the actual reasoning I need to grab from R new notes each step of a 16 step sequencer. > - 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 > Thats work! adding the ampersand keeps ChucK on time having access to R functions, I will try to explore this solution for now. In my case: Blocking : Std.system("Rscript corpus.R > out.log 2> /dev/null"); Non-blocking: Std.system("Rscript corpus.R & > out.log 2> /dev/null"); > - use OSC to communicate with a separate long-running script that runs > whatever you need > I currently use OSC to fetch the R data at each step, but you make me wonder if there is a better way best regards, federico > > On Thu, Dec 31, 2020 at 3:33 AM federico lopez <fede2...@gmail.com> wrote: > >> 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 >> > _______________________________________________ > chuck-users mailing list > chuck-users@lists.cs.princeton.edu > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users >
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users