I haven&#39;t done this in a while, so I don&#39;t have the code at my fingertips, but I used to read in sound files and then &#39;preheat&#39; them by accessing at least one sample.  This would force them to get paged in, and (if you had enough physical memory) would reduce the overhead when you actually went to access them.<br><br><div class="gmail_quote">On Thu Jan 29 2015 at 9:50:38 AM Julian Faust &lt;<a href="mailto:julian.faust@gmail.com">julian.faust@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>If you know in advance what set of files to choose from, you could start by reading in a text file with all the file paths then make the random selection in chuck. This avoids system calls, which can mess with the timing of your real-time application since the chuck VM misses the time spent doing the system call (i.e. Std.system(“sleep 1”) causes mayhem). But if you want to be able to add files to a directory on the fly I think you have to do the system call. Just be aware of the timing issue - maybe it can be done in a thread.</div><div><br></div><div>-Julian</div><div><br></div></div>
</blockquote></div>