Finding path of sound file

I’m very new to SuperCollider and am having a hard time finding any documentation about the file path to read a sound file into a buffer. How do I set the correct file path and where does the macOS SuperCollider app look for the root folder for a sound file?

Try to copy-paste an audio file from Finder to your SC document! You’ll get the absolute file path typed down for you :slight_smile:

About the root:
If the path is absolute (starts with “/”) the root is the root of your filesystem
If the path is relative (doesn’t start with “/”), it is relative to your home folder, at least on my machine

1 Like

Thanks that was easy!

Also fun: drag the file into the IDE window and watch the path appear wherever you drop it.

1 Like

You might find using Dialog more interesting/useful, if you’re looking for files on a regular basis. Here’s an example:

(
Dialog.openPanel({ arg path;
    path.postln;
});
)

You’ll see the file path is posted in the post window (and you can copy and paste that too). Furthermore, if you want to try it out, you could do a little test using an environment variable like this:

(
Dialog.openPanel({ |path|
		~b = Buffer.read(s, path);
	});
)

~b.play;

I hope that helps.

Oh, and by the way … welcome to our community!

2 Likes

Awesome this will be a lot of help in the future!