File Path Help

Oct 11, 2009 at 1:17pm

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,
Mitch

#45810
Oct 11, 2009 at 1:24pm

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”

lh

#165163
Oct 11, 2009 at 4:03pm

Hi Mitch,

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:

http://www.cycling74.com/forums/index.php?t=msg&goto=180448&rid=0&srch=Miguel#msg_180448

Hope you find this useful.

-Miguel

#165164
Oct 12, 2009 at 6:32pm

Miguel,
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

[int box]
|
[open ./MySubFolder/$1.wav ( < - this is a message
|

And the resulting message is:
open ./MySubFolder/1.wav

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,
Mitch

#165165

You must be logged in to reply to this topic.