<div dir="ltr"><div dir="ltr"><div><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 31, 2020 at 6:42 PM Spencer Salazar <<a href="mailto:spencer.salazar@gmail.com">spencer.salazar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Correct, Std.system does block concurrency. Depending on what you're trying to do there are a few workarounds..</div></div></blockquote><div><br></div><div>Hi Spencer, thanks for your response</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div>- make any Std.system calls at the beginning of your ChucK script, before audio has started processing</div></div></div></blockquote><div> </div><div>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.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>- 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: <a href="https://stackoverflow.com/a/5691067" target="_blank">https://stackoverflow.com/a/5691067</a></div></div></div></blockquote><div><br></div><div>Thats work! adding the ampersand keeps ChucK on time having access to R functions, I will try to explore this solution for now.</div><div><br></div><div>In my case:</div><div>Blocking : Std.system("Rscript corpus.R > out.log 2> /dev/null"); </div><div><br></div><div>Non-blocking: Std.system("Rscript corpus.R & > out.log 2> /dev/null"); <br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>- use OSC to communicate with a separate long-running script that runs whatever you need<br></div></div></div></blockquote><div> </div><div>I currently use OSC to fetch the R data at each step, but you make me wonder if there is a better way<br></div><div><br></div><div>best regards, </div><div><br></div><div>federico</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 31, 2020 at 3:33 AM federico lopez <<a href="mailto:fede2001@gmail.com" target="_blank">fede2001@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi, <br></div><div>Is the ChucK thread disrupted by the execution time of a Std.system script call?</div><div><br></div><div>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.</div><div><br></div><div>I'm trying to call R scripts using ChucK concurrency.<br></div><div><br></div>// test code, run with --caution-to-the-wind command-line flag<br>Noise n => Envelope e => dac;<br><br>fun void metro()<br>{<br> while(true)<br> {<br> e.keyOn();<br> 10::ms => now;<br> e.keyOff();<br> 990::ms => now;<br> <<< now, "samples" >>>;<br> }<br>}<br><br>fun void callSystem()<br>{<br> while(true)<br> {<br> Std.system("sleep 0"); // comment this to test<br> //Std.system("sleep 3"); // uncomment this to test<br> 1000::ms => now;<br> }<br>}<br><br>spork~ metro();<br>spork~ callSystem();<br><div>while(true){10::ms => now;}</div><div><br></div><div>// end test code<br></div><div><br></div><div><br></div><br><div><br></div><div><br></div><br></div>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div></div>