Forums > MaxMSP

How do I specify a filepath?

June 30, 2008 | 10:56 am

Hi sorry guys, I’m trying really hard to not get frustrated over this :P (newbie)

I’ve built a simple generative music player that works from samples, if I save the patch in the sample folder it will read them and works efficiently, obviously I don’t want the patch to be mixed up in this folder, I want it to be at a higher level in the project folder and to know where to read the samples from on my HD. I’ve tried a number of objects that are mentioned in the documentation but I can’t work out how to specify a filepath, just getting error messages!!

At the moment the patch opens the files with a loadbang going into a message specifying the particular files, but as I mentioned, only works if the patch is in the samle folder

can anyone help me out with this?

Aid


June 30, 2008 | 11:22 am

Think this has been asked a couple times before^^…

You can include subfolders in the search path, and max will be able to find them. But this can get messy, for example when multiple files are in different folders but have the same name.

Another way is to specify full paths when loading the samples. If you know where the sample directory is, store the folder path somewhere (like [zl reg]), and then add the filename to it with a [sprintf %s%s]. You can even load the sample names into a ubumenu…

Good luck!


June 30, 2008 | 11:46 am

is it possible with a [folder] object ?


June 30, 2008 | 12:50 pm

Yes, very much so. Here’s a part of what i use to load dirs into ubumenus. It checks for a file extension and sends it through.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 421 76 103 196617 grab patch directory;
#P comment 422 373 94 196617 add to list of files;
#P comment 422 312 174 196617 compare extension (external , jasch);
#P comment 422 179 75 196617 output all files;
#P comment 422 137 56 196617 add subdir;
#P newex 305 117 44 196617 zl nth 1;
#P newex 305 96 99 196617 regexp (.+/)([^/]+);
#P newex 305 158 51 196617 tosymbol;
#P newex 305 137 108 196617 sprintf %sMySubDir/;
#P newex 305 396 51 196617 tosymbol;
#P newex 382 430 46 196617 zl group;
#P newex 382 452 68 196617 s ToUbumenu;
#P newex 305 287 40 196617 itoa;
#P newex 305 373 78 196617 prepend append;
#P newex 305 331 32 196617 sel 1;
#P newex 305 352 59 196617 zl reg;
#P newex 305 222 59 196617 t l l;
#P newex 236 287 62 196617 prepend set;
#P newex 192 45 77 196617 t b path .wav b;
#P newex 305 311 42 196617 strcmp;
#P newex 305 262 51 196617 zl ecils 4;
#P newex 305 243 40 196617 atoi;
#P newex 305 200 67 196617 route append;
#N thispatcher;
#Q end;
#P newobj 254 76 61 196617 thispatcher;
#P newex 305 179 37 196617 folder;
#P comment 422 96 223 196617 go up 1 level (dont ask me how the code works);
#P connect 15 0 14 0;
#P connect 20 0 17 0;
#P connect 17 0 18 0;
#P fasten 7 3 15 0 263 416 387 416;
#P fasten 7 0 15 0 197 416 387 416;
#P connect 7 2 8 0;
#P connect 7 1 2 0;
#P connect 2 1 19 0;
#P connect 19 1 20 0;
#P connect 18 0 1 0;
#P connect 1 0 3 0;
#P connect 3 0 9 0;
#P connect 9 0 4 0;
#P connect 4 0 5 0;
#P connect 5 1 13 0;
#P fasten 8 0 6 0 241 307 310 307;
#P connect 13 0 6 0;
#P connect 6 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 12 0;
#P fasten 3 1 16 0 367 392 310 392;
#P connect 12 0 16 0;
#P connect 9 1 10 1;
#P fasten 16 0 15 0 310 417 387 417;
#P window clipboard copycount 26;


June 30, 2008 | 12:54 pm

thx !

i will check it out tonight


June 30, 2008 | 3:16 pm

thankyou, this sounds very similar to the method I was trying though, could I trouble you for a screen shot implementing this?

I did also try to use the "folder" object but with no results either, I am more than sure that I am using the correct filepath, but I imagine I am inserting or implementing it in the wrong way.

There must be a simple way to do this!

cheers again

aid


July 1, 2008 | 8:36 am

Just a picture of the patch? You out of max then?
Sure, no prob…

http://img392.imageshack.us/img392/9021/picture12vb7.png


July 2, 2008 | 12:48 pm

I found a much easier way to do it (maybe specifically for what I was doing) you go into the "options" drop menu and then open the "file preferences", there you can quickly designate a folder in a search path and even give it a name tag, I just added the tag in a message object then and the patch detected my samples straight away!

Yay


July 2, 2008 | 1:00 pm

ok that’s good to know.

would you show or share a patch ?


July 2, 2008 | 1:16 pm

Quote: Lematt wrote on Wed, 02 July 2008 14:00
—————————————————-
> ok that’s good to know.
>
> would you show or share a patch ?
—————————————————-

ok, I’m fairly new to max/msp so this is a really basic patch! :P it’s basically a two track generative music player

as I mentioned "Samples A" is a tag designated in "File Preferences" which can be found in the "Options" drop down menu, If you are using a previous version of Max than 5 then you won’t be able to designate a tagname as far as I know, however you can just copy and paste the search path and it will do the same job.

I’m not sure yet, but I suspect that if you were to compile the patch as an application and run it on a different machine then it would have trouble locating the folder (as the search path would change) I will be working on this over the next few days and post my results if anyone is interested

if anyone more experienced is looking at this and can see errors in my terminology or anything, please correct me, it would be much appreciated!

Aid


July 2, 2008 | 1:29 pm

ok thanks for the .png

yeah it wouldn’t work on my computer, but with the screenshot i get the idea.

it’s crazy: does Max create all the message "open … .wav preload jkjk.wav preload blahblah.wav" by itself on the loadbang ?


July 2, 2008 | 2:15 pm

Quote: Lematt wrote on Wed, 02 July 2008 14:29
—————————————————-

> it’s crazy: does Max create all the message "open … .wav preload jkjk.wav preload blahblah.wav" by itself on the loadbang ?
>
>
—————————————————-

no I had to type all of that!! and as this project developes I will be using loads more samples, so I need to find a better way to do this, I want the random function to work by selecting the files from a designated folder, on the hard disk, without me having to specify all the filenames


July 2, 2008 | 2:23 pm

oh god… it’s a lot to type.

i guess it’s better to use [folder] and a umenu, than a [random] choosing the files in the menu.


July 2, 2008 | 2:27 pm

but then it’s no longer a generative player :P


July 2, 2008 | 2:30 pm

well…

i guess yes !

it’s the same process than yours, but realized differently.

i’ll try to patch it later.


July 2, 2008 | 2:48 pm

hey, i compiled the patch as an app, transferred it to another computer and it all worked fine!! I included the sample folder in the build. I think the only error is I used samples at 96k and the app is trying to play them at 44.1


July 2, 2008 | 2:59 pm

Quote: Lematt wrote on Wed, 02 July 2008 15:23
—————————————————-
> oh god… it’s a lot to type.
>
> i guess it’s better to use [folder] and a umenu, than a [random] choosing the files in the menu.
—————————————————-

oh wait, yes I see what you are saying now this could be really handy!


July 2, 2008 | 3:23 pm

here’s a patch i have been converting from max 4 > 5. it loads samples in a folder (drag & drop) into a coll.

hopefully, this will provide some insights…

j


July 2, 2008 | 3:26 pm

i can’t seem to open the .wav files in the umenu, it will detect like .rtf or .maxpat but nothing else?


July 2, 2008 | 3:42 pm

take a close look at the patch i just posted, particularly the patcher "create playlist"… you will see the types message is going to the folder object, and it specifies audio files only!

j


July 4, 2008 | 10:11 am

yep I fixed that, the problem was the umenu didn’t like me specifying the file type, it detected them all after that.

The problem I have now is that I can’t work out how to preload/cue the samples from the umenu to work with my original patch, the max help states that the files in the menu are assigned a number related to their position in the list starting at 0, given that there must be a way to assign those numbers as cues, any tips? I’ve been tackling it for a couple of hours and only managed to cue list number 1, and I’m not sure how I did that :P

Aid


July 4, 2008 | 5:39 pm

group all ur filenames into one list with "zl group", then pass it through "listfunnel". this will index each item in the list, then you will probably need something like "prepend preload" before sending it to sfplay…

hth,

j


Viewing 22 posts - 1 through 22 (of 22 total)