Best practices for directory structure / writing buffer~ objects to load files automatically

James Harkins's icon

With apologies if this is a dumb question...

In a workshop setting, I just had terrible trouble with loading soundfiles, so I'd like to ask about best practices for audio file locations, to minimize "File Preferences" customization and (ideally) setting things up so that people can open a patch and it Just Works.

I wasn't quite ready for that because, on my machine, I can put the audio files in the same folder as the patch files (or a subfolder), and then relative paths with "." work just fine, e.g., [buffer~ buf ./audio/loop.wav].

So I guided people through preparing an audio file, putting it where they are going to save the patch, saving the patch in that place, and then, on Mac... "can't open." I confirmed in their Finder that the directory structure was correct, just... no relative path access.

Also tried a message box with variants of "audio/loop.wav" --> [absolutepath] --> [prepend replace] --> [buffer~ buf] and continued to see failures.

It surprises me because in general, I would expect consistent behavior across platforms. E.g., SuperCollider always uses absolute paths (so it's necessary to ask the interpreter for the currently executing path, strip the base filename, and append from there -- but this approach is consistent everywhere); Pd vanilla objects always resolve relative paths relative to the current patch file (some externals don't always do that, but this is consistent across the base distribution). In neither environment is it necessary to make allowances for OS.

Normally I'd make a MWE myself, but I can't reproduce the problem on my machine. I could try to collect screenshots if that would help.

TIA,

hjh

Source Audio's icon

I allways use absolute paths to load files.

relative path only works after patch is stored to disk,

and sometimes it does not work at all for whatever reason.

subfolders definitely need absolute path.

./ can not be used in objects like buffer~ directly because they do not resolve paths.