Forums > MaxMSP

alternate merge init

September 27, 2006 | 2:19 pm

hi, i am trying to take two init values [1111, 2222] and alternate merge
them into [12121212],
there most be a cleaner way. this uses Lmerge and regexp

max v2;
#N vpatcher 15 55 615 455;
#P button 225 26 15 0;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P newex 259 113 66 9109516 regexp \\d;
#P message 259 82 36 9109516 3333;
#P newex 176 115 66 9109516 regexp \\d;
#P message 176 84 36 9109516 1111;
#P newex 208 163 51 9109516 Lmerge;
#P message 209 251 71 9109516 13131313;
#P newex 209 220 35 9109516 _ set;
#P newex 208 192 154 9109516 regexp \\s @substitute %0;
#P connect 8 0 4 0;
#P connect 4 0 5 0;
#P connect 5 2 3 0;
#P connect 3 0 0 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 7 2 3 1;
#P connect 8 0 6 0;
#P connect 6 0 7 0;
#P pop;


September 27, 2006 | 2:38 pm

It’s not cleaner, but it might be more flexible – I’ve included patch-
ups for 2 and 3 incoming source values.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 615 337 1215 737;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 176 51 27 196617 t b i;
#P inlet 176 30 15 0;
#P window linecount 1;
#P newex 97 129 35 196617 zl nth;
#P newex 50 102 34 196617 zl len;
#P newex 86 102 36 196617 zl reg;
#P newex 112 74 40 196617 atoi;
#P newex 112 50 51 196617 tosymbol;
#P inlet 112 30 15 0;
#P outlet 97 151 15 0;
#P outlet 50 124 15 0;
#P connect 4 0 6 0;
#P connect 6 0 0 0;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 1 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 1;
#P connect 9 1 7 1;
#P connect 8 0 9 0;
#P pop;
#P newobj 517 154 60 196617 p theworks;
#P message 517 123 40 196617 33333;
#P newex 660 343 32 196617 print;
#P newex 660 321 40 196617 itoa;
#P newex 660 300 39 196617 thresh;
#P button 627 88 15 0;
#N vpatcher 615 337 1215 737;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 176 51 27 196617 t b i;
#P inlet 176 30 15 0;
#P window linecount 1;
#P newex 97 129 35 196617 zl nth;
#P newex 50 102 34 196617 zl len;
#P newex 86 102 36 196617 zl reg;
#P newex 112 74 40 196617 atoi;
#P newex 112 50 51 196617 tosymbol;
#P inlet 112 30 15 0;
#P outlet 97 151 15 0;
#P outlet 50 124 15 0;
#P connect 4 0 6 0;
#P connect 6 0 0 0;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 1 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 1;
#P connect 9 1 7 1;
#P connect 8 0 9 0;
#P pop;
#P newobj 664 154 60 196617 p theworks;
#P newex 582 191 39 196617 thresh;
#N vpatcher 615 337 1215 737;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 176 51 27 196617 t b i;
#P inlet 176 30 15 0;
#P window linecount 1;
#P newex 97 129 35 196617 zl nth;
#P newex 50 102 34 196617 zl len;
#P newex 86 102 36 196617 zl reg;
#P newex 112 74 40 196617 atoi;
#P newex 112 50 51 196617 tosymbol;
#P inlet 112 30 15 0;
#P outlet 97 151 15 0;
#P outlet 50 124 15 0;
#P connect 4 0 6 0;
#P connect 6 0 0 0;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 1 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 1;
#P connect 9 1 7 1;
#P connect 8 0 9 0;
#P pop;
#P newobj 582 154 60 196617 p theworks;
#P newex 582 218 53 196617 maximum;
#P newex 582 246 40 196617 Uzi;
#P message 664 123 34 196617 1111;
#P message 582 123 34 196617 2222;
#P newex 331 343 32 196617 print;
#P newex 331 321 40 196617 itoa;
#P newex 331 300 39 196617 thresh;
#P button 298 88 15 0;
#N vpatcher 615 337 1215 737;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 176 51 27 196617 t b i;
#P inlet 176 30 15 0;
#P window linecount 1;
#P newex 97 129 35 196617 zl nth;
#P newex 50 102 34 196617 zl len;
#P newex 86 102 36 196617 zl reg;
#P newex 112 74 40 196617 atoi;
#P newex 112 50 51 196617 tosymbol;
#P inlet 112 30 15 0;
#P outlet 97 151 15 0;
#P outlet 50 124 15 0;
#P connect 4 0 6 0;
#P connect 6 0 0 0;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 1 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 1;
#P connect 9 1 7 1;
#P connect 8 0 9 0;
#P pop;
#P newobj 335 154 60 196617 p theworks;
#P newex 253 191 39 196617 thresh;
#N vpatcher 615 337 1215 737;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 176 51 27 196617 t b i;
#P inlet 176 30 15 0;
#P window linecount 1;
#P newex 97 129 35 196617 zl nth;
#P newex 50 102 34 196617 zl len;
#P newex 86 102 36 196617 zl reg;
#P newex 112 74 40 196617 atoi;
#P newex 112 50 51 196617 tosymbol;
#P inlet 112 30 15 0;
#P outlet 97 151 15 0;
#P outlet 50 124 15 0;
#P connect 4 0 6 0;
#P connect 6 0 0 0;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 1 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 1;
#P connect 9 1 7 1;
#P connect 8 0 9 0;
#P pop;
#P newobj 253 154 60 196617 p theworks;
#P newex 253 218 53 196617 maximum;
#P newex 253 246 40 196617 Uzi;
#P message 335 123 34 196617 1111;
#P message 253 123 34 196617 2222;
#P connect 18 0 22 0;
#P connect 18 0 11 0;
#P connect 18 0 12 0;
#P fasten 13 2 23 1 617 286 763 286 763 144 572 144;
#P fasten 13 2 15 1 617 278 756 278 756 143 637 143;
#P fasten 13 2 17 1 617 270 749 270 749 148 719 148;
#P connect 23 1 19 0;
#P connect 23 0 16 0;
#P connect 22 0 23 0;
#P connect 11 0 15 0;
#P connect 15 0 16 0;
#P connect 16 0 14 0;
#P connect 14 0 13 0;
#P connect 17 0 16 0;
#P connect 12 0 17 0;
#P connect 17 1 19 0;
#P connect 15 1 19 0;
#P connect 19 0 20 0;
#P connect 20 0 21 0;
#P connect 7 0 0 0;
#P connect 7 0 1 0;
#P connect 9 0 10 0;
#P connect 8 0 9 0;
#P connect 4 1 8 0;
#P connect 6 1 8 0;
#P fasten 2 2 4 1 288 278 427 278 427 143 308 143;
#P fasten 2 2 6 1 288 270 420 270 420 148 390 148;
#P connect 1 0 6 0;
#P connect 6 0 5 0;
#P connect 3 0 2 0;
#P connect 5 0 3 0;
#P connect 4 0 5 0;
#P connect 0 0 4 0;
#P window clipboard copycount 24;

Am 27.09.2006 um 16:19 schrieb yair reshef:

> there most be a cleaner way. this uses Lmerge and regexp


September 27, 2006 | 2:41 pm

Like this maybe? At least there are only native max objects..

Mattijs

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 98 119 137 196617 12121212;
#N vpatcher 50 119 304 422;
#P window setfont "Sans Serif" 9.;
#P newex 33 56 27 196617 t b l;
#P window linecount 1;
#P newex 98 228 40 196617 itoa;
#P newex 125 182 47 196617 zl mth 1;
#P newex 50 134 27 196617 t b i;
#P newex 98 208 46 196617 zl group;
#P newex 125 159 36 196617 zl reg;
#P newex 50 115 58 196617 unpack 0 0;
#P newex 151 75 40 196617 atoi;
#P newex 50 95 52 196617 listfunnel;
#P newex 50 75 40 196617 atoi;
#P inlet 151 39 15 0;
#P inlet 33 39 15 0;
#P outlet 98 250 15 0;
#P connect 1 0 12 0;
#P connect 12 1 3 0;
#P connect 3 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 9 0;
#P fasten 12 0 8 0 38 204 103 204;
#P connect 6 1 8 0;
#P connect 10 0 8 0;
#P connect 8 0 11 0;
#P connect 11 0 0 0;
#P fasten 9 0 7 0 55 155 130 155;
#P connect 7 0 10 0;
#P connect 2 0 5 0;
#P connect 5 0 7 1;
#P fasten 9 1 10 1 72 179 167 179;
#P pop;
#P newobj 98 81 58 196617 p altMerge;
#P newex 98 100 62 196617 prepend set;
#P message 146 64 34 196617 2222;
#P message 98 64 34 196617 1111;
#P connect 3 0 2 0;
#P connect 2 0 4 0;
#P connect 1 0 3 1;
#P connect 0 0 3 0;
#P window clipboard copycount 5;


October 2, 2006 | 9:03 am

Mattijs Kneppers wrote:
> Like this maybe? At least there are only native max objects..

love it…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


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