I haven't done this in a while, so I don't have the code at my fingertips, but I used to read in sound files and then 'preheat' 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.

On Thu Jan 29 2015 at 9:50:38 AM Julian Faust <julian.faust@gmail.com> wrote:
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.

-Julian