#N canvas 414 212 309 368 10; #X obj 77 139 t f b; #X obj 20 189 until; #X obj 20 232 f; #X obj 51 232 + 1; #X obj 20 254 t f f; #X obj 20 277 sel; #X obj 47 277 outlet counter; #X obj 20 299 outlet bang; #X obj 35 210 f; #X obj 54 46 inlet start_val; #X obj 89 70 inlet end_val; #X obj 189 172 inlet stop; #N canvas 591 222 544 372 start-end 0; #X obj 283 97 loadbang; #X obj 160 253 f; #X obj 232 162 \$1; #X obj 277 162 \$2; #X obj 322 210 outlet to_sel; #X obj 232 253 outlet to_counter; #X obj 250 62 t b f; #X obj 232 15 inlet start_val; #X obj 250 37 inlet end_val; #X obj 160 305 outlet num_of_iterations; #X obj 322 162 \$3; #X obj 283 119 t b b b; #N canvas 170 127 830 473 define_start_and_end 0; #X obj 283 69 t f f; #X obj 310 92 != 0; #X obj 342 413 outlet to_counter; #X obj 342 312 *; #X obj 127 388 +; #X obj 127 413 outlet num_of_iterations; #X obj 178 259 t f f; #X obj 310 117 ||; #N canvas 457 216 578 391 swap_or_no_swap 0; #X obj 140 257 swap; #X obj 140 283 -; #X text 170 264 if an end value is provided and it's greater than the start value \, swap incoming values to get difference and add 1 so you end at the given value \, not one before. if it's not provided use first value only for number of iterations; #X obj 30 49 t f f; #X obj 147 56 t f f; #X obj 140 231 spigot; #X obj 186 240 spigot; #X obj 30 208 spigot; #X obj 70 236 spigot; #X obj 30 253 -; #X obj 30 345 outlet diff; #X obj 30 127 t f f; #X obj 159 127 t f f; #X obj 159 99 f; #X obj 76 130 t f f f; #X obj 76 159 == 0; #X obj 76 181 t f f; #X obj 57 73 <; #X obj 57 95 t b f f; #X obj 266 156 outlet up_or_down; #X obj 266 112 * 2; #X obj 266 134 - 1; #X text 292 121 make 0 or 1 \, -1 or 1; #X obj 30 27 inlet start_val; #X obj 147 28 inlet end_val; #X connect 0 0 1 0; #X connect 0 1 1 1; #X connect 1 0 10 0; #X connect 3 0 11 0; #X connect 3 1 17 0; #X connect 4 0 17 1; #X connect 4 1 13 1; #X connect 5 0 0 0; #X connect 6 0 0 1; #X connect 7 0 9 0; #X connect 8 0 9 1; #X connect 9 0 10 0; #X connect 11 0 7 0; #X connect 11 1 5 0; #X connect 12 0 8 0; #X connect 12 1 6 0; #X connect 13 0 12 0; #X connect 14 0 15 0; #X connect 14 1 5 1; #X connect 14 2 6 1; #X connect 15 0 16 0; #X connect 16 0 7 1; #X connect 16 1 8 1; #X connect 17 0 18 0; #X connect 18 0 13 0; #X connect 18 1 14 0; #X connect 18 2 20 0; #X connect 20 0 21 0; #X connect 21 0 19 0; #X connect 23 0 3 0; #X connect 24 0 4 0; #X restore 178 358 pd swap_or_no_swap; #X text 341 100 if a 0 is provided as an end value \, use a third \, non zero argument to be able to use the end value; #X obj 473 375 outlet up_or_down; #X text 348 330 if no end value is provided send a zero to counter start and the provided value to [sel]. otherwise send the first argument to counter start and the second to [sel]; #X obj 576 281 outlet to_sel; #X obj 127 295 t f f f; #X obj 283 264 t f f; #X obj 576 259 - 1; #X obj 222 138 ||; #X obj 310 225 t f f f f f; #X obj 127 121 t f f; #X obj 18 99 inlet input_val; #X obj 127 177 spigot; #X obj 18 146 spigot; #X text 18 65 if no args are provided; #X text 19 77 send incoming value to [sel]; #X obj 51 123 == 0; #X obj 261 181 s \$0-args; #X obj 222 160 t f f f; #X text 321 168 send to [pd diffuse_bang] which is in the parent patch of this subpatch to define whether a bang will go to [f ] or straight to [until]; #X obj 127 99 inlet start_val; #X obj 283 47 inlet end_val; #X obj 399 47 inlet additional_val; #X obj 283 293 spigot; #N canvas 169 136 318 296 gate 0; #X obj 50 77 t f f; #X obj 50 149 spigot; #X obj 50 171 outlet; #X obj 165 149 spigot; #X obj 165 171 outlet; #X obj 50 55 inlet value; #X obj 171 58 inlet which; #X obj 171 80 t f f; #X obj 83 120 == 0; #X connect 0 0 1 0; #X connect 0 1 3 0; #X connect 1 0 2 0; #X connect 3 0 4 0; #X connect 5 0 0 0; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 7 1 3 1; #X connect 8 0 1 1; #X restore 127 242 pd gate; #X connect 0 0 14 0; #X connect 0 1 1 0; #X connect 1 0 7 0; #X connect 3 0 2 0; #X connect 4 0 5 0; #X connect 6 0 8 0; #X connect 6 1 3 0; #X connect 7 0 17 0; #X connect 8 0 4 0; #X connect 8 1 10 0; #X connect 13 0 4 0; #X connect 13 1 15 0; #X connect 13 2 3 0; #X connect 14 0 31 0; #X connect 14 1 12 0; #X connect 15 0 12 0; #X connect 16 0 26 0; #X connect 17 0 32 1; #X connect 17 1 4 1; #X connect 17 2 31 1; #X connect 17 3 3 1; #X connect 17 4 16 1; #X connect 18 0 20 0; #X connect 18 1 16 0; #X connect 19 0 21 0; #X connect 20 0 32 0; #X connect 21 0 15 0; #X connect 24 0 21 1; #X connect 26 0 20 1; #X connect 26 1 24 0; #X connect 26 2 25 0; #X connect 28 0 18 0; #X connect 29 0 0 0; #X connect 30 0 7 1; #X connect 31 0 8 1; #X connect 32 0 13 0; #X connect 32 1 6 0; #X restore 187 186 pd define_start_and_end; #X obj 277 231 outlet up_or_down; #X obj 52 15 inlet bang_or_val; #X obj 160 58 t f f; #X obj 52 41 route bang; #N canvas 179 65 352 257 diffuse_bang 0; #X obj 173 57 r \$0-args; #X obj 57 57 inlet; #X obj 57 79 t b b; #X obj 57 137 spigot; #X obj 167 137 spigot; #X obj 173 79 t f f; #X obj 90 111 == 0; #X obj 57 159 outlet to_until; #X obj 167 159 outlet to_f; #X connect 0 0 5 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 2 1 4 0; #X connect 3 0 7 0; #X connect 4 0 8 0; #X connect 5 0 6 0; #X connect 5 1 4 1; #X connect 6 0 3 1; #X restore 52 236 pd diffuse_bang; #X connect 0 0 11 0; #X connect 1 0 9 0; #X connect 2 0 12 1; #X connect 3 0 12 2; #X connect 6 0 2 0; #X connect 6 1 3 0; #X connect 7 0 2 0; #X connect 8 0 6 0; #X connect 10 0 12 3; #X connect 11 0 2 0; #X connect 11 1 3 0; #X connect 11 2 10 0; #X connect 12 0 1 1; #X connect 12 1 5 0; #X connect 12 2 13 0; #X connect 12 3 4 0; #X connect 14 0 16 0; #X connect 15 0 1 0; #X connect 15 1 12 0; #X connect 16 0 17 0; #X connect 16 1 15 0; #X connect 17 0 9 0; #X connect 17 1 1 0; #X restore 20 95 pd start-end; #X obj 20 13 inlet bang_or_val; #X obj 20 117 route bang; #X obj 20 139 t b b; #X connect 0 0 1 0; #X connect 0 1 8 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 2 0 4 0; #X connect 3 0 2 1; #X connect 4 0 5 0; #X connect 4 1 6 0; #X connect 5 0 7 0; #X connect 8 0 2 1; #X connect 9 0 12 1; #X connect 10 0 12 2; #X connect 11 0 1 1; #X connect 12 0 14 0; #X connect 12 1 8 1; #X connect 12 2 3 1; #X connect 12 3 5 1; #X connect 13 0 12 0; #X connect 14 0 15 0; #X connect 14 1 0 0; #X connect 15 0 1 0; #X connect 15 1 8 0;