File Path Help
I have a large number of audio files named 1.wav, 2.wav, 3.wav, etc… and I am sending the message:
"open $1.wav, 1"
to an [sfplay~] object. The $1 is being replaced by an int. This is working very well.
What I’d like to do is put this large number of audio files (100 or so) into a subfolder, to make my patcher folder a little bit neater.
So, the Max patch would be in a folder called something like "MyMaxPatch" and the audio files would be in "MyMaxPatch/MyAudioSubFolder".
Can someone tell me what message I should send to [sfplay~] that is similar to the one above where the audio files are all in a subfolder.
Here is the message I tried, but it did not work
"open ./MyAudioSubFolder/$1.wav, 1"
If possible, I’d like to use a relative path, in case I move the folder to another machine.
Any help would be greatly appreciated,
You need to use the full file path, on a mac this will be something like:
open "Macintosh HD:/Users/YOURNAME/MyMaxPatch/MyAudioSubFolder/123.wav"
The problem with absolute paths is, well, that they are absolute! so moving your patch around your HD will cause it to stop loading your files.
I posted a solution to this some time ago. It is a small abstraction that generates absolute paths relative your main patch each time you open it. It does exactly what you are trying to do (except that instead of "open $1.wav, 1" you would send something in the lines of "open /subfolder/$1.wav, 1"
You can find it here:
Hope you find this useful.
Thanks so much. I’ll take a look at your abstraction.
What I don’t understand, is that this is easy in Pd. In fact, in Pd one can do the following
[open ./MySubFolder/$1.wav ( < - this is a message
And the resulting message is:
where the $1 is replaced by the int coming from the int box. So, the dollar sign is being replace mid-message.
Anyway, thanks again for the help,