Hello,
I would like to start creating my own sound library to work with Supercollider. I’ve been looking around, but I see it’s a bit of a confusing topic.
Could someone tell me some ideas to create and organize my own sound libraries?
Thanks
Are you thinking of samples / recorded sound, synths, or something else?
I am thinking samples/recorded soumds
Depends on your needs and use cases, I guess… My approach is to record stuff, chop it up into slices in audacity or reaper, create a folder inside ~/mySamples
organized by content. Next, I will symlink whatever folders I need into an audio
folder inside the project folder and run this on a singleton class that holds global variables:
*loadBuffers {|path|
server.doWhenBooted({
var audioDirCount=0;
buf = Dictionary.new;
PathName((path).standardizePath).folders.do({|folder|
buf[folder.folderName.asSymbol] = SoundFile.collectIntoBuffersMono(folder.fullPath+/+"*");
folder.fullPath.postln;
audioDirCount = audioDirCount + 1;
});
"% audio directories loaded\n".postf(audioDirCount);
});
}
SoundFile.collectIntoBuffersMono
is just a simple extension of the .collectIntoBuffers
method of SoundFile
that selects only the first channel of whatever file I throw at it.
This way, the buffers become available by their folder names. In my case, the singleton class is called BBS
and I can access buffers like this:
BBS.buf[\recordingsOfMySquirrels][0].play
or whatever your samples are called.
You might also want to look into @madskjeldgaard’s PolyBuf quark, which does pretty much the same thing.
EDIT: this happens on Linux, but should work pretty much out of the box on Mac as well. Windows might be a bit more finicky, but I don’t know that platform very well…
I recently discovered PathName
will call .standardizePath
for you, under the hood.
Class Document
does the same, as well.
So the standardizePath
call is not necessary for PathName
? Good to know!
In addition to that I also create folders with ‘tag names’ and create symlinks there too to find stuff faster. No need for a db other than the file system.
You can try: sccode
using: search
+ code
And then, after a few searches https://sccode.org/1-5eV may help.
I use this class to manage loading samples from my library. My classification scheme is a bit arbitrary, but this helps to automate things, especially when I want to e.g. load a bank of samples from a folder.
This needs the Require
quark.
Example:
// Root folder.
// SAMP tries to resolve paths FIRST as an absolute path. THEN as relative to the folder of the current .scd file, THEN relaive to .root
SAMP.root = "/Users/fsc/Documents/_sounds";
// lazyLoading=true only loads files when you access them. This is faster when loading folders with many samples,
// but since sample loading takes time, it can cause errors when trying to use a sample that isn't loaded.
SAMP.lazyLoading = false;
// * is supported as a wildcard. Extensions are not required.
// This works whether or not a server is running, and samples will be automatically loaded when the server is launched.
SAMP("drum 1/*");
// Play first sample. Samples are sorted deterministically, and some basic
// numbering schemes are sorted correctly.
SAMP("drum 1/*")[0].play
Synth(\samplePlayer, args:[\buffer, SAMP("drum 1/*")[0]]);
// When a string is used to access a sample, the first sample with
// the string anywhere in it's name is returned. This will match
// "clap.wav", "drums-clap.wav", "01-clap-quiet.aiff", etc.
// * works as a wildcard, but only the first match is returned.
SAMP("drum 1/*")["clap"].play;
// Channels arg will force loading only some channels of a file.
// This is equivalent to Buffer.readChannel(channels:(0..n-1))
SAMP("counterstrike/*", channels:1)[0].play;
// Display a UI with all samples. Clicking can preview, dragging
// produces a sclang string to load the sample. Note that this does
// not work well with lazyLoading=true, because samples are loaded
// only after being accessed the first time.
SAMP("drum 1/*").gui