Path to Samples

Hi Forum,

I have a piece that I am working on that requires samples to be loaded from a file. Rather than set the path to the samples (on the machine provided to me at gallery) I would rather have it work on any machine. It is really just a convenience thing for others that might need to get it working.

At the moment it looks like this…

~fileSamples = SoundFile.collectIntoBuffers("/Users/scott.simon...

Is there a way to wrap the samples in the folder with the .scd file that will find those samples regardless of which machine it is on?

Many thanks.

I think (someone could maybe confirm this) that you need to use ‘PathName’, so your file load line would look something like this:

~fileSamples = PathName(thisProcess.nowExecutingPath).parentPath++"nameOfFolder/aFile.wav"

I hope that helps.


yep that helped. Many Thanks!

For completeness the entire code for loading samples in from a folder in the same directory as the .scd file:


Yes, I forgot to do it for several files, I thought about that later and thought you’d understand.

Glad it solved the problem.

Shortcut for future:

-> /usr/local/share/

-> /usr/local/share