Forums > MaxMSP

counter with variable step


FP
October 12, 2008 | 12:43 pm

hi,

i’m sorry, but i can’t achieve to do a counter in wich i can change the step.
i used the [counter] object. all is ok for "up" mode.
but all becomes complicated with "down" and "palindrome" modes.

i’m sure somebody made it before me.
so if you can share or give advice. thx in advance.

here’s what i did :
#P window setfont "Sans Serif" 9.;
#P user umenu 221 103 38 196647 1 64 119 1;
#X add up;
#X add down;
#X add palindrome;
#P number 319 82 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname min;
#P window linecount 1;
#P newex 357 183 53 196617 autopattr;
#X prestore max 1 0 19;
#X prestore min 1 0 0;
#X prestore step 1 0 3;
#P objectname u918000133;
#P flonum 205 321 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 253 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 64 270 59 196617 print count;
#P number 263 170 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname step;
#P newex 205 300 27 196617 / 1.;
#P window setfont "Sans Serif" 18.;
#P number 64 241 59 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 205 55 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 205 74 58 196617 metro 500;
#P newex 168 235 27 196617 + 1;
#P newex 168 257 47 196617 gate 2 1;
#P newex 205 277 40 196617 10000;
#P number 319 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname max;
#P message 168 277 14 196617 0;
#P newex 205 235 32 196617 sel 1;
#P newex 205 216 48 196617 > 10000;
#P button 205 131 15 0;
#P newex 205 190 27 196617 * 1;
#N counter 0 0 19;
#X flags 0 0;
#P newobj 205 150 77 196617 counter 0 0 19;
#P comment 262 105 50 196617 direction;
#P comment 300 171 29 196617 step;
#P comment 356 103 29 196617 max;
#P window linecount 3;
#P comment 354 239 203 196617 mode up : OK mode down : first count is higher than max mode palindrome : doesn’t work;
#P connect 5 0 16 0;
#P connect 5 0 7 0;
#P connect 24 0 13 0;
#P connect 24 0 4 1;
#P fasten 18 0 5 1 268 187 227 187;
#P fasten 18 0 17 1 268 296 227 296;
#P fasten 10 0 11 1 324 271 240 271;
#P fasten 10 0 7 1 324 211 248 211;
#P fasten 10 0 4 4 324 147 274 147;
#P connect 20 0 14 1;
#P connect 21 0 4 2;
#P connect 9 0 4 2;
#P connect 17 0 21 0;
#P connect 11 0 17 0;
#P connect 12 1 11 0;
#P connect 8 0 12 1;
#P connect 7 0 8 0;
#P connect 4 0 5 0;
#P connect 6 0 4 0;
#P connect 14 0 6 0;
#P connect 15 0 14 0;
#P connect 12 0 9 0;
#P connect 13 0 12 0;
#P connect 16 0 19 0;
#P window clipboard copycount 25;


October 12, 2008 | 12:54 pm

I’d use accum.



FP
October 12, 2008 | 1:06 pm



FP
October 12, 2008 | 1:31 pm


October 12, 2008 | 4:55 pm

On Oct 12, 2008, at 5:43 AM, fp wrote:

> i’m sorry, but i can’t achieve to do a counter wich i can change the
> step.
> i used the [counter] object. all is ok for "up" mode.
> but all becomes complicated with "down" and "palindrome" modes.

I’m not 100% sure I understand what you’re trying to accomplish, but
maybe this is closer? :

#P window setfont "Sans Serif" 9.;
#P number 319 259 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname step[1];
#P window linecount 1;
#P comment 361 261 73 196617 steps in range;
#P newex 319 238 27 196617 /;
#P newex 328 216 27 196617 t b i;
#P user umenu 221 122 77 196647 1 64 138 1;
#X add up;
#X add down;
#X add palindrome;
#P newex 446 162 53 196617 autopattr;
#X prestore max 1 0 22;
#X prestore step 1 0 3;
#X prestore step[1] 1 0 7;
#P objectname u687000001;
#P number 253 55 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 205 309 59 196617 print count;
#P number 243 180 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname step;
#P window setfont "Sans Serif" 18.;
#P number 205 280 59 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 205 55 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 205 74 58 196617 metro 500;
#P number 319 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname max;
#P button 205 94 15 0;
#P newex 205 240 27 196617 * 1;
#N counter 0 0 19;
#X flags 0 0;
#P newobj 205 150 77 196617 counter 0 0 19;
#P comment 222 109 50 196617 direction;
#P comment 280 181 29 196617 step;
#P comment 356 103 29 196617 max;
#P window linecount 3;
#P comment 354 310 203 196617 mode up : OK mode down : first count is
higher than max mode palindrome : doesn’t work;
#P fasten 11 0 5 1 248 205 227 205;
#P fasten 11 0 16 0 248 205 333 205;
#P fasten 19 0 4 4 324 281 359 281 359 144 274 144;
#P connect 17 0 19 0;
#P connect 7 0 17 0;
#P connect 16 1 17 1;
#P connect 16 0 17 0;
#P connect 10 0 12 0;
#P connect 9 0 8 0;
#P connect 8 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 5 0;
#P connect 13 0 8 1;
#P connect 15 0 4 1;
#P connect 5 0 10 0;
#P window clipboard copycount 20;

Chris Muir
cbm@well.com

http://www.xfade.com



FP
October 12, 2008 | 6:59 pm



FP
October 12, 2008 | 7:15 pm


October 12, 2008 | 7:45 pm

On Oct 12, 2008, at 12:15 PM, elt wrote:

> i’m confuse but now i can’t find how to manage the minimum count…

Well, depending on what you want to do, there’s the setmin message to
counter, but note that that will be the minimum before doing the step
multiplication.

Perhaps a "goal statement" is in order here: what are you trying to do
exactly?

-C

Chris Muir
cbm@well.com

http://www.xfade.com



FP
October 12, 2008 | 7:59 pm


October 12, 2008 | 10:52 pm

[sorry if this gets posted twice.]

On Oct 12, 2008, at 12:59 PM, elt wrote:
>here’s what i can achieve from your solution.

It seems like your approach is trying to get counter to conform after it has counted. My approach is to get counter to count the right range to begin with.

#P window setfont "Sans Serif" 9.;
#P number 157 172 35 9 1 0 161 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname step[2];
#P window linecount 1;
#P comment 200 173 35 196617 range;
#P newex 157 152 27 196617 -;
#P newex 166 130 27 196617 t b i;
#P window setfont "Sans Serif" 18.;
#P number 43 289 45 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname min[3];
#P window setfont "Sans Serif" 9.;
#P number 166 105 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname min;
#P comment 202 106 29 196617 min;
#P newex 43 257 41 196617 + 0;
#P comment 199 246 73 196617 steps in range;
#P newex 157 223 27 196617 / 1;
#P newex 166 201 27 196617 t b i;
#P user umenu 58 105 77 196647 1 64 121 1;
#X add up;
#X add down;
#X add palindrome;
#P newex 284 145 53 196617 autopattr;
#X prestore max 1 0 19;
#X prestore min 1 0 3;
#X prestore min[3] 1 0 6;
#X prestore step 1 0 3;
#X prestore step[1] 1 0 5;
#X prestore step[2] 1 0 16;
#P objectname u436000005;
#P number 91 38 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 60 172 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname step;
#P toggle 43 38 15 0;
#P newex 43 57 58 196617 metro 500;
#P number 157 86 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname max;
#P button 43 77 15 0;
#P newex 43 232 27 196617 * 1;
#N counter 0 0 1;
#X flags 0 0;
#P newobj 43 134 71 196617 counter 0 0 1;
#P comment 59 92 50 196617 direction;
#P comment 97 173 29 196617 step;
#P comment 194 86 29 196617 max;
#P number 157 244 35 9 1 0 161 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname step[1];
#P connect 19 0 17 1;
#P connect 19 0 21 0;
#P fasten 10 0 5 1 65 197 65 197;
#P fasten 10 0 14 0 65 197 171 197;
#P connect 24 0 15 0;
#P connect 22 0 24 0;
#P connect 9 0 8 0;
#P connect 8 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 17 0;
#P connect 17 0 20 0;
#P connect 13 0 4 1;
#P connect 11 0 8 1;
#P fasten 0 0 4 4 162 263 197 263 197 127 108 127;
#P connect 7 0 22 0;
#P connect 21 0 22 0;
#P connect 14 0 15 0;
#P connect 15 0 0 0;
#P connect 21 1 22 1;
#P connect 14 1 15 1;
#P window clipboard copycount 25;



FP
October 13, 2008 | 7:19 am


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