Syncronizing Lists?

Jun 22, 2007 at 11:45pm

Syncronizing Lists?

Hey,

I’m having trouble syncronizing two lists. I want to format a nsub message to a coll in order to update the sample at specific indices , which means I need changeable arguments for the first and last parameters of the message. The problem I am having is that I can’t get the second list to iterate in sync with the first i.e., list #1 = 1, 2, 3, etc. and list #2 = random 16. I’ve tried table, pack, funbuff, buddy and sprintf. If I could get sprintf to sync inlets that would be fabulous. The problem is that my first list is triggering output and consequently I’m only getting the last int from the second list.

Thanks for any ideas,

J

#32588
Jun 23, 2007 at 9:09am

hm, i dont get, what your problem is exactly… can you post an example patch, that explains it more concrete?

Gerald

#107569
Jun 23, 2007 at 10:10am

#107570
Jun 24, 2007 at 1:50am

Here is a little example patch. I want the output of the last arg to sprintf to be in sync with the first arg:

1 2 sample3
2 2 sample5
3 2 sample1
etc…

instead, I’m only getting the last iteration of the second arg.

The second arg is a random 16 + 1 to pack while the first arg is indexed 1-16. When the iteration has completed it will all have been be passed to coll as nsub. I’m still messing with lobjects(lpair).

Here is the code:

/*
max v2;
#N vpatcher 10 59 729 746;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 238 440 32 196617 print;
#P newex 321 328 25 196617 iter;
#P newex 66 322 25 196617 iter;
#P button 223 60 15 0;
#P newex 179 362 111 196617 sprintf %i 2 sample%i;
#P newex 225 90 30 196617 t b b;
#P newex 317 213 48 196617 pack 0 0;
#P newex 317 246 222 196617 route 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16;
#P newex 245 177 27 196617 + 1;
#P newex 245 147 58 196617 random 16;
#P newex 245 119 82 196617 uzi 16;
#P newex 60 280 216 196617 pack 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16;
#P newex 317 277 209 196617 pack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#P connect 7 0 1 0;
#P connect 1 0 10 0;
#P connect 10 0 8 0;
#P connect 9 0 7 0;
#P connect 8 0 12 0;
#P connect 7 1 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 11 0 8 1;
#P connect 2 2 6 0;
#P connect 6 0 5 0;
#P connect 5 0 0 0;
#P connect 0 0 11 0;
#P connect 5 1 0 1;
#P connect 5 2 0 2;
#P fasten 4 0 6 1 250 203 360 203;
#P connect 5 3 0 3;
#P connect 5 4 0 4;
#P connect 5 5 0 5;
#P connect 5 6 0 6;
#P connect 5 7 0 7;
#P connect 5 8 0 8;
#P connect 5 9 0 9;
#P connect 5 10 0 10;
#P connect 5 11 0 11;
#P connect 5 12 0 12;
#P connect 5 13 0 13;
#P connect 5 14 0 14;
#P connect 5 15 0 15;
#P pop;
*/

Thanks for the assistance,

J

#107571
Jun 24, 2007 at 2:33am

Thanks for the lpair suggestion, that was it!

If you’re at all curious:

/*
max v2;
#N vpatcher 168 88 887 775;
#P window setfont “Sans Serif” 9.;
#P newex 171 436 30 196617 pack;
#P newex 182 397 31 196617 lpair;
#P newex 333 239 37 196617 zl rev;
#P newex 500 612 32 196617 print;
#P newex 66 322 25 196617 iter;
#P button 223 60 15 0;
#P newex 500 586 102 196617 sprintf %i sample%i;
#P newex 241 93 30 196617 t b b;
#P newex 333 213 48 196617 pack 0 0;
#P newex 333 267 222 196617 route 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16;
#P newex 261 177 27 196617 + 1;
#P newex 261 147 58 196617 random 16;
#P newex 261 119 82 196617 uzi 16;
#P newex 60 280 216 196617 pack 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16;
#P newex 333 293 209 196617 pack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#P connect 7 0 1 0;
#P connect 1 0 10 0;
#P connect 13 0 14 0;
#P connect 10 0 13 0;
#P connect 13 1 14 1;
#P connect 0 0 13 1;
#P connect 9 0 7 0;
#P connect 7 1 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 2 2 6 0;
#P connect 6 0 12 0;
#P connect 12 0 5 0;
#P connect 5 0 0 0;
#P connect 5 1 0 1;
#P connect 5 2 0 2;
#P fasten 4 0 6 1 266 203 376 203;
#P connect 5 3 0 3;
#P connect 5 4 0 4;
#P connect 5 5 0 5;
#P connect 5 6 0 6;
#P connect 5 7 0 7;
#P connect 5 8 0 8;
#P connect 5 9 0 9;
#P connect 5 10 0 10;
#P connect 5 11 0 11;
#P connect 5 12 0 12;
#P connect 14 0 8 0;
#P connect 8 0 11 0;
#P connect 5 13 0 13;
#P connect 5 14 0 14;
#P connect 5 15 0 15;
#P pop;
*/

Thanks again,

J

#107572
Jun 24, 2007 at 9:11am

On 24 Jun 2007, at 04:33, Jason wrote:

>
> Thanks for the lpair suggestion, that was it!

why not use a simple solution like this?

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 349 131 27 196617 t i b;
#P newex 305 219 32 196617 print;
#P button 305 79 21 0;
#P newex 305 193 111 196617 sprintf %i 2 sample%i;
#P newex 366 155 58 196617 random 16;
#P newex 305 107 55 196617 uzi 16;
#P connect 5 0 2 0;
#P connect 1 0 2 1;
#P connect 2 0 4 0;
#P connect 5 1 1 0;
#P connect 0 2 5 0;
#P connect 3 0 0 0;
#P window clipboard copycount 6;

or like this:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 66 152 74 196617 swap;
#P newex 66 207 32 196617 print;
#P button 66 67 21 0;
#P newex 66 181 111 196617 sprintf %i 2 sample%i;
#P newex 66 123 58 196617 random 16;
#P newex 66 95 75 196617 uzi 16;
#P connect 2 0 4 0;
#P connect 5 0 2 0;
#P connect 5 1 2 1;
#P connect 3 0 0 0;
#P connect 1 0 5 0;
#P connect 0 2 5 1;
#P connect 0 0 1 0;
#P window clipboard copycount 6;

#107573
Jun 25, 2007 at 1:26am

Thanks for the more concise algorithm, that really helped me out.

J

#107574

You must be logged in to reply to this topic.