rylanschneider
Joined: Jul 31, 2022 Posts: 1 Location: usa
|
Posted: Sun Jul 31, 2022 8:07 am Post subject:
How to load multiple sndbuf |
 |
|
First post!
I've been trying out chuck and in the examples for sndbuf, a fully qualified pathname is required to read in a sound file. Is that supposed to be the case?
I've also got this idea for storing a bunch of files in various folders, based on some kind of group similarity and having chuck randomly pick one to play. But i can't seem to find any native file handling/string handling capability with chuck. Is there any way around it?
The only other way i can think of, is to use perl or bash and randomly feed this to chuck. But this kind of sucks because if you want to attach a midi controller to alter parameters, this won't work because there's no way to marshal all sounds to go through one chuck program.
Any thoughts???? |
|
Borogove
Joined: Dec 11, 2022 Posts: 1 Location: California
|
Posted: Sun Dec 11, 2022 8:47 pm Post subject:
|
 |
|
I couldn't find a way of processing the contents of a directory/folder, but by naming a number of samples similarly with a sequential numerical ID, I was able to assemble random drum sets, e.g.:
fun string getSamplePath( string basePath, int numSamples )
{
Math.random2(1,numSamples) => int index;
Std.itoa(index) => string indexStr;
return basePath + indexStr + ".wav";
}
getSamplePath( me.dir() + "samples/Drench/KICK/KIK ", 65 ) => string
kickPath;
getSamplePath( me.dir() + "samples/Drench/SNARE/SNR ", 51 ) => string snarePath;
getSamplePath( me.dir() + "samples/Drench/HAT/HAT ", 37 ) => string hat1Path;
This expects that in the named path, you'll have a series of files named "KIK1.wav", "KIK2.wav" ... "KIK65.wav", and so forth. Ugly, but it worked for my purposes. The ability to read a directory into an array of strings would be very useful. |
|