Forums > MaxMSP

How to populate a coll with a list of files?

April 1, 2006 | 1:34 pm

I need to populate a coll with a filenames of files contained in a
folder.

For now, I use ubumenu (with dropfile) to get the list of files and
then I parse them one by one to get them into coll. I know there are
very handy third party objects that do this kind of stuff, but for
this I want to use only standard distribution objects.

What I did works, but from time to time there is some parsing error
(like non exiting files appearing in a list), that i didn’t manage to
nail yet. I will make it work, but i was wondering if there was some
other automatic and more reliable method to acomplish this.

I would be very happy if I could somehow read the content of ubumenu,
but that doesn’t seem to be possible.

I suppose this kind of thing could be easily done with Java, but I
don’t know anything about that stuff.

Klif


April 1, 2006 | 5:06 pm

can you post the patch, so the hive mind can take a look and see
where the error might be?

v a d e //

http://www.vade.info
abstrakt.vade.info


April 2, 2006 | 12:22 pm

thanx vade.

My prime concern was if there is some easier way to acomplish this.

Thinking about the problem I realised I was parsing using metro to
drive it. I think i should change this and bang the next read (from
ubumenu) when previous file has finished parsing.

Also, there might be some problems with patch initialisation.

I’ll clean the patch and post the results/problems.

Again, thanx for your concern.

Klif


April 2, 2006 | 8:19 pm

Hello klif,
this is how I once did it, using the folder object.
this was a while back, and only used on a mac.
so lots of disclaimers here.
I am not sure if this addresses your "parsing errors" problem.
HtH anyway.
-jennek

max v2;
#N vpatcher 10 59 539 578;
#P window setfont "Sans Serif" 9.;
#P newex 333 428 69 196617 print fullpath;
#P newex 333 377 67 196617 prepend path;
#P number 333 40 35 9 0 0 64 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 56 64 62 196617 prepend set;
#P message 56 40 53 196617 /Volumes;
#P message 218 92 53 196617 /Volumes;
#P newex 204 64 53 196617 t b b b b;
#P newex 333 404 78 196617 sprintf %s/%s;
#P newex 333 341 65 196617 route symbol;
#P message 284 214 31 196617 clear;
#N coll ;
#P newobj 204 308 53 196617 coll;
#P message 232 111 35 196617 types;
#P newex 204 272 74 196617 pack 0 s;
#P newex 204 231 74 196617 t b s;
#P message 232 214 14 196617 1;
#N counter;
#X flags 0 0;
#P newobj 204 252 66 196617 counter;
#P button 244 184 15 0;
#P newex 204 160 91 196617 route append clear;
#P button 204 40 15 0;
#P newex 204 136 35 196617 folder;
#P comment 56 23 79 196617 enter path here;
#B color 14;
#P comment 270 112 100 196617 enter your type here;
#B color 14;
#P comment 204 23 47 196617 load coll;
#B color 14;
#P comment 332 23 138 196617 retrieve one entry from coll;
#B color 14;
#P connect 19 0 20 0;
#P connect 5 0 17 0;
#P connect 17 0 4 0;
#P connect 18 0 4 0;
#P connect 12 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 10 0;
#P connect 10 0 8 0;
#P connect 8 0 11 0;
#P fasten 21 0 13 0 338 302 209 302;
#P fasten 14 0 13 0 289 297 209 297;
#P connect 11 0 13 0;
#P fasten 20 0 18 0 61 86 223 86;
#P connect 17 1 18 0;
#P connect 17 2 12 0;
#P fasten 7 0 9 0 249 206 237 206;
#P connect 9 0 8 2;
#P connect 6 1 7 0;
#P connect 10 1 11 1;
#P fasten 7 0 14 0 249 206 289 206;
#P fasten 13 0 15 0 209 333 338 333;
#P fasten 20 0 22 0 61 370 338 370;
#P connect 15 0 22 0;
#P connect 22 0 16 0;
#P connect 16 0 23 0;
#P pop;


April 3, 2006 | 4:38 pm

Thanks Jennek, and vade!

I completely forgot about folder object. I was using it before, but
since ubumenu appeared, it seems that folder object disappeared from
my fragile memory ;)

As for parsing errors that i was mentioning before, I figured what
was wrong (I still don’t know why tough).

I was using a feedback loop to feed the counter at the "top" of the
patch. Counter would trigger ubumenu/coll filled with filenames. Then
I would do some processing on the filename (extracting date and time
values from filenames *** see below), saving results in second coll.

Obviously, counter was banged by last operation in the chain (in this
case, it was parsed data going to second coll). For some reason, the
loop would stop ocasionally, and I needed to add considerable delay
(and different amounts => delay 3 on dual 2Gig G5, delay 10 on dual
1Gig G4, delay 15 on Titanium 400mhz) to get all the values.

After some messing with the patch, I ended up using deferlow followed
by delay in feedback loop. Now the patch works sucessfully on all
machines I tried it on.

I seem to remember that I used to have similar problems before, when
I would be using long lists stored in colls.

It would probably be easier if I posted the simplified patch in the
first place, but I don’t have license for max on my old laptop that I
use to check mail, so I can’t easily prepare and send patches.

Klif

*** This is the part of the project I don’t know much about. Some
kind of video server, records video into mpeg files, and names them
by date and time (like VIDEO_20061015_234512.mpg YYYYMMDD_HHMMSS
format). My friend wants to read specific files/time and do some
processing on it.

I need data in format YMMDDHHMMSS – in that case, I can directly
compare values using ">" and "< " objects, to find files containing
specific "moment in time".


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