Random samples from directory

I’m trying to play samples randomly from a directory using loop() but am having some issues. I am able to locate the folder and access the samples individually however loop() does not allow for the sample argument to be a list (i.e. sample=[1,2,3,4]). My real goal, however, is to be able to select samples at random on the fly.

s1 >> loop(“/usr/local/lib/python2.7/site-packages/FoxDot/snd/loop/”, dur=1/4, sample=41)

Is there a better way to do this or something that I’m overlooking?

Thanks!

The loop SynthDef loads a single file into memory either by specifying it directly through the path (or name if it is in the _loop_ folder) or by folder and sample number. I will have a look at the code at doing samples at random but right now it isn’t possible I’m afraid. You could, however, put samples in a “letter” folder i.e. snd/x/upper for example and use:

p1 >> play("X", dur=1/4, sample=P[:4])

Thank you for the prompt reply! This is a fair workaround. Much appreciated.