structural help please!

Jun 14, 2006 at 3:37pm

structural help please!

Hey there,

been working hard on this bit of patch which will be used as a tracking system for music patterns.

Basically a list of numbers determines certain sounds that get played. If a zero is located in the list, it will play nothing for that bar (this patcher is hooked to a metro system).

I am implementing a feature where if a person makes a mistake, they can choose any number in the list to ‘delete’ which will set that box to zero.

If they then choose to place another pattern in, i wish that the pattern number be placed in the list, from left to right, overwriting the first zero it finds. The cases and problem will be listed below (with examples)

Pattern number ‘injected’ = 9
Pattern contents: 1 2 3 4 5 6
What happens: Nothing. This is good, because the list is full.

Pattern number ‘injected’ = 9
Pattern contents: 1 2 3 0 5 6
What happens: List is replaced with 1 2 3 9 5 6. This is good.

Pattern number ‘injected’ = 9
Pattern contents: 1 2 3 4 5 0
What happens: Nothing. list gets sent to zero_on_end (i will be implementing this feature soon/now.

Pattern number ‘injected’ = 9
Pattern contents: 1 2 0 0 5 6
What happens: List is replaced by 1 2 0 9 5 6. Here is the problem! We should have ended up with 1 2 9 0 5 6, but the zero is on the other side.

I believe the problem has to do with the calculation of splitting the lists (near the zl slice functions) and maybe has something to do with the ‘- 1′ function. However, i am not sure how i can modify what i have here to get the correct result if two zero’s are present, without disrupting the existing 3 cases.

This makes my brain hurt.. I will keep at it, but the patcher is listed below if anyone could try and provide a solution i would hugely appreciate it.

Patcher is included in msp file and text.

Regards,
n00ds

————————-

max v2;
#N vpatcher 270 27 1114 807;
#P window setfont “Sans Serif” 9.;
#P newex 387 204 104 9109513 send crash_into_helmet;
#P newex 175 582 82 9109513 send zero_on_end;
#P newex 67 710 104 9109513 send crash_into_helmet;
#P newex 265 300 113 9109513 send noodly_appendages;
#P comment 393 239 100 9109513 if the zero is on the front , process that. if not , send to noodly appendages of much list splitting/injection love.;
#P newex 390 77 27 9109513 t b l;
#P message 425 137 50 9109513 3;
#P newex 425 102 54 9109513 prepend set;
#P newex 425 79 74 9109513 receive grab_int;
#P newex 387 144 30 9109513 zl join;
#P newex 387 173 54 9109513 prepend set;
#P newex 379 45 43 9109513 zl slice 1;
#P message 299 213 14 9109513 0;
#P newex 314 183 27 9109513 == 1;
#P button 276 149 15 0;
#P newex 280 74 53 9109513 t l l b b;
#P newex 297 149 27 9109513 gate;
#P message 297 110 14 9109513 1;
#P message 278 111 14 9109513 0;
#P user gswitch2 314 241 39 32 0 0;
#P newex 314 121 39 9109513 zl sub 0;
#P newex 280 46 78 9109513 receive has_zero;
#P newex 28 269 64 9109513 send has_zero;
#P newex 88 344 124 9109513 receive noodly_appendages;
#P newex 67 687 54 9109513 prepend set;
#P newex 67 662 30 9109513 zl join;
#P newex 27 549 74 9109513 receive grab_int;
#P newex 174 142 63 9109513 send grab_int;
#P newex 157 118 27 9109513 t b i;
#P button 128 75 15 0;
#P message 157 96 50 9109513 3;
#P newex 157 71 54 9109513 prepend set;
#P number 157 50 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 67 632 30 9109513 zl join;
#P newex 126 626 43 9109513 zl slice 1;
#P newex 134 578 27 9109513 – 1;
#P newex 102 604 34 9109513 zl slice;
#P newex 78 508 27 9109513 ==;
#P newex 68 422 39 9109513 zl sub 0;
#P button 28 479 15 0;
#P message 27 445 14 9109513 0;
#P newex 51 479 27 9109513 gate;
#P message 51 445 14 9109513 1;
#P newex 110 423 29 9109513 zl len;
#P message 146 424 14 9109513 0;
#P user gswitch2 146 539 39 32 0 0;
#P newex 88 370 66 9109513 t l l l b b;
#P newex 27 42 114 9109513 receive crash_into_helmet;
#P newex 115 266 104 9109513 send crash_into_helmet;
#P newex 115 242 54 9109513 prepend set;
#P newex 39 90 40 9109513 t l l b;
#P user gswitch2 28 209 39 32 0 0;
#P message 49 148 14 9109513 0;
#P message 86 144 14 9109513 1;
#P newex 49 121 39 9109513 zl sub 0;
#P message 27 69 60 9109513 3 1 1 3 3 3 1;
#P comment 67 292 100 9109513 the original data vacates here if it has a zero.;
#P user panel 11 31 236 305;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 257 31 278 305;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 173 643 100 9109513 noodly appendages will split lists , and replace zero with desired number , else will spit out if the zero is on the end;
#P user panel 10 339 272 399;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 13 0 5 0;
#P fasten 32 0 5 0 162 143 105 143 105 65 32 65;
#P fasten 21 0 20 0 33 500 22 500 22 436 32 436;
#P fasten 8 0 9 0 54 208 33 208;
#P fasten 7 0 9 0 91 173 33 173;
#P connect 9 0 38 0;
#P fasten 19 0 21 0 56 502 46 502 46 472 33 472;
#P connect 5 0 10 0;
#P fasten 10 1 6 0 59 115 54 115;
#P connect 6 0 8 0;
#P fasten 14 4 18 0 149 399 56 399;
#P fasten 18 0 19 0 56 475 56 475;
#P fasten 20 0 19 0 32 468 56 468;
#P fasten 10 0 9 1 44 168 62 168;
#P fasten 24 0 27 0 107 628 72 628;
#P fasten 27 0 35 0 72 659 72 659;
#P connect 35 0 36 0;
#P connect 36 0 58 0;
#P fasten 14 1 22 0 107 417 73 417;
#P connect 22 0 19 1;
#P fasten 19 0 23 0 56 502 83 502;
#P fasten 10 2 7 0 74 114 91 114;
#P fasten 34 0 27 1 32 628 92 628;
#P fasten 26 1 35 1 164 654 92 654;
#P connect 37 0 14 0;
#P fasten 17 0 23 1 115 451 100 451;
#P fasten 15 0 24 0 151 577 107 577;
#P fasten 14 2 17 0 121 417 115 417;
#P connect 9 1 11 0;
#P connect 11 0 12 0;
#P fasten 25 0 24 1 139 600 131 600;
#P connect 24 1 26 0;
#P fasten 22 0 25 0 73 451 139 451;
#P fasten 14 3 16 0 135 407 151 407;
#P connect 16 0 15 0;
#P fasten 23 0 15 0 83 532 151 532;
#P connect 28 0 29 0;
#P fasten 29 0 30 0 162 88 162 88;
#P fasten 31 0 30 0 133 93 162 93;
#P connect 30 0 32 0;
#P connect 32 1 33 0;
#P fasten 14 0 15 1 93 417 180 417;
#P connect 15 1 59 0;
#P fasten 41 0 57 0 319 287 270 287;
#P fasten 44 0 46 0 302 179 293 179 293 143 281 143;
#P fasten 46 0 42 0 281 179 270 179 270 105 283 105;
#P connect 39 0 45 0;
#P fasten 45 2 43 0 313 99 302 99;
#P fasten 42 0 44 0 283 137 302 137;
#P connect 43 0 44 0;
#P fasten 45 3 48 0 327 99 360 99 360 209 304 209;
#P fasten 45 1 40 0 299 99 319 99;
#P connect 40 0 44 1;
#P fasten 44 0 47 0 302 179 319 179;
#P fasten 48 0 41 0 304 234 319 234;
#P connect 47 0 41 0;
#P fasten 45 0 41 1 285 99 360 99 360 234 348 234;
#P fasten 41 1 49 0 348 276 372 276 372 35 384 35;
#P fasten 54 0 51 0 430 162 421 162 421 139 392 139;
#P connect 51 0 50 0;
#P connect 50 0 60 0;
#P connect 49 1 55 0;
#P fasten 55 1 51 1 412 120 412 120;
#P connect 52 0 53 0;
#P fasten 55 0 54 0 395 127 430 127;
#P fasten 53 0 54 0 430 127 430 127;
#P pop;

—————–

#26412
Jun 14, 2006 at 4:36pm

never mind, crisis over! forgot what my actual concept was. 3 part 56 command pile of junk replaced by 1 20 command subroutine. :D

#78938
Jun 14, 2006 at 8:01pm

I like that. Don’t worry, my brain hurts most of the time as well.

#78939
Jun 17, 2006 at 8:02am

seb wrote:
> never mind, crisis over! forgot what my actual concept was. 3 part 56
> command pile of junk replaced by 1 20 command subroutine.

Aah, you switched to a state of real creativity… Love it!

Stefan


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

#78940

You must be logged in to reply to this topic.