<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hey Mike,<div><br></div><div>Check out the &quot;chunks&quot; parameter of SndBuf: </div><div><a href="https://ccrma.stanford.edu/~spencer/ckdoc/ugen.html#SndBuf">https://ccrma.stanford.edu/~spencer/ckdoc/ugen.html#SndBuf</a><br></div><div><br></div><div>This was added a little later and was designed to avoid the huge hit of loading the entire file into memory at once by reading the file  in fixed-sized chunks, on-demand. You can play with it a bit but something like 2048 or 4096 is probably a good starting point. (Lower than that will likely provide incremental performance gain; you can go as high as you want up until you start getting crackling again.) As long as you dont try to access the whole file immediately (e.g. for normalization or other offline processing) it should do the trick for your use case. There may be other limitations but Im not able to recall them off the top of my head. </div><div><br></div><div>Btw, me.yield doesn&#39;t allow for sound to process, for that you would actually want to pass time in between the audio file loads, at least one buffer size&#39;s worth of samples. me.yield is chiefly a way to tell the shreduler to run other shreds without a progression of audio time. </div><div><br></div><div>Spencer</div><div><br><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 2, 2020 at 2:20 PM mike clemow &lt;<a href="mailto:michaelclemow@gmail.com">michaelclemow@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hey Michael! It&#39;s been a minute!</div><div><br></div><div>Thanks so much for that suggestion! I took a closer look at this code and I&#39;m actually not doing Machine.add(); four times in a row, but rather spork ~ thingOne(); four times (although I do Machine.remove() four times to remove the shreds by ID). </div><div><br></div><div>I still think the thing that I forgot to do is to add me.yield(); in between each of these (or at least at the end of the four lines) to keep the running audio smooth. I&#39;m going through and trying it out. </div><div><br></div><div>Since each of these functions that are running concurrently are loading large files into SndBuf instances, I&#39;m hesitant to do the normal Chuckian thing and load it all up first and then let it play on demand using, as you suggest, a start() function or similar. Also, because I&#39;m triggering these &quot;cues&quot; from across a network, I&#39;m trying to trade &quot;immediate and real time&quot; for &quot;reliable and low-memory impact.&quot; I&#39;ve definitely built applications like that with Chuck that ate all the memory before! There&#39;s no streaming from disk implemented under the hood, unless I&#39;m mistaken.</div><div><br></div><div>Let me see how this works and I&#39;ll report back!</div><div><br></div><div>Mike</div><div><br></div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px">--</span></div><div><span style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px">Michael Clemow</span></div><div><div style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px"><span>Artist</span>/Composer/<span>Sound</span> Designer</div><div style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px"><a href="http://michaelclemow.com/" style="color:rgb(126,87,194)" target="_blank">http://michaelclemow.com</a></div><span style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px">(he/him)</span><br></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 2, 2020 at 5:07 PM Michael Heuer &lt;<a href="mailto:heuermh@gmail.com" target="_blank">heuermh@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div>Hello Mike,<div><br></div><div>Since Machine.add is hitting the file system and parsing and evaluating the ChucK scripts, it might work better to do all of that in one go when not generating sound</div><div><br></div><div>Machine.add(&quot;thingOne.ck&quot;);<br>Machine.add(&quot;thingTwo.ck&quot;);<br>Machine.add(&quot;thingThree.ck&quot;);<br>Machine.add(&quot;thingFour.ck&quot;);<br><br>And then later call methods to initialize them serially or in different shreds, something like</div><div><br></div><div>thingOne.start();</div><div>thingTwo.start();</div><div>thingThree.start();</div><div><div>thingFour.start();</div></div><div><br></div><div>spork ~ thingOne.start();</div><div><div>spork ~ thingTwo.start();</div></div><div><div>spork ~ thingThree.start();</div></div><div><div>spork ~ thingFour.start();</div></div><div><br></div><div>Hope this helps,</div><div><br></div><div>   michael</div><div><br><div><br><blockquote type="cite"><div>Begin forwarded message:</div><br><div style="margin:0px"><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif;color:rgb(0,0,0)"><b>From: </b></span><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">mike clemow &lt;<a href="mailto:michaelclemow@gmail.com" target="_blank">michaelclemow@gmail.com</a>&gt;<br></span></div><div style="margin:0px"><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif;color:rgb(0,0,0)"><b>Subject: </b></span><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif"><b>[chuck-users] Machine.add() and me.yield()</b><br></span></div><div style="margin:0px"><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif;color:rgb(0,0,0)"><b>Date: </b></span><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">July 2, 2020 at 3:43:51 PM CDT<br></span></div><div style="margin:0px"><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif;color:rgb(0,0,0)"><b>To: </b></span><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">ChucK Users Mailing List &lt;<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a>&gt;<br></span></div><div style="margin:0px"><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif;color:rgb(0,0,0)"><b>Reply-To: </b></span><span style="font-family:-webkit-system-font,&quot;Helvetica Neue&quot;,Helvetica,sans-serif">ChucK Users Mailing List &lt;<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a>&gt;<br></span></div><br><div><div dir="ltr"><div>Greetings Chuckists,</div><div><br></div><div>Looking for validation on this before I change many, many lines of code: I&#39;m noticing clicks and pops in running audio when I do something like this:</div><div><br></div><div>Machine.add(&quot;thingOne.ck&quot;);</div><div><div>Machine.add(&quot;thingTwo.ck&quot;);</div><div></div></div><div>Machine.add(&quot;thingThree.ck&quot;);</div><div></div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Machine.add(&quot;thingFour.ck&quot;);</div><div><br></div><div>and also with Machine.remove(idNum); four times in a row.</div><div><br></div><div>Question:</div><div><br></div><div>Is this:</div><div><br></div><div><div>Machine.add(&quot;thingOne.ck&quot;);</div><div><div>Machine.add(&quot;thingTwo.ck&quot;);</div><div></div></div><div>Machine.add(&quot;thingThree.ck&quot;);</div><div></div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Machine.add(&quot;thingFour.ck&quot;);</div><div>me.yield();</div><div><br></div><div>significantly different than this:</div><div><br></div><div><div>Machine.add(&quot;thingOne.ck&quot;);</div><div><div>me.yield();</div><div>Machine.add(&quot;thingTwo.ck&quot;);</div><div></div></div><div>me.yield();</div><div>Machine.add(&quot;thingThree.ck&quot;);</div><div></div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>me.yield();</div><div>Machine.add(&quot;thingFour.ck&quot;);</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div>me.yield();<br></div><div><br></div><div>???</div><div><br></div><div>The same for sporking shreds four in a row.</div><div><br></div><div>Warmly,</div><div>Mike</div><div><br></div><div></div><div><span style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px">--</span></div><div><span style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px">Michael Clemow</span></div><div><div style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px"><span>Artist</span>/Composer/<span>Sound</span> Designer</div><div style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;line-height:19.5px"><a href="http://michaelclemow.com/" style="color:rgb(126,87,194)" target="_blank">http://michaelclemow.com</a></div><span style="color:rgb(117,117,117);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px">(he/him)</span><br></div></div></div></div></div></div></div></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" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br></div></blockquote></div><br></div></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>