Accum

Feb 22, 2007 at 11:31pm

Accum

Does anyone use accum? One of my students found it and used in his first
patch. It doesn’t seem to do what I expected and the help and manual don’t
help or man…Is it me or is funky?

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#30423
Feb 22, 2007 at 11:49pm

it’s a pretty basic object. it’s cleaner than using a bunch of [int] and [+] and [*] objects.

try opening the help patch on it. send a value into the left inlet, and that will set (and output) the “initial value” stored in the accum object. then, send a value into the middle inlet. that value will be added to the “initial value”, and then that sum will be stored as the “current value”. however, nothing is output until it receives a bang in its left inlet. similarly, values sent into the right inlet will multiply the current value.

if your confusion comes from the fact that nothing is output when the object’s value changes, then try using a [t b i] object to trigger a bang to the left inlet whenever a value is sent to the middle or right inlets.

-scott

#97302
Feb 22, 2007 at 11:59pm

I’ve used it a few times. It’s like a very odd counter. The trick is
you have to always send a value to the center inlet (the amount you
want to add to the “accumulation”, then bang the left inlet to get
the result. e.g.

max v2;
#N vpatcher 10 59 610 459;
#P button 157 208 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 177 253 14 196617 2;
#P newex 157 232 30 196617 t b b;
#P number 157 313 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 157 288 50 196617 accum;
#P connect 4 0 2 0;
#P connect 2 0 0 0;
#P connect 0 0 1 0;
#P connect 2 1 3 0;
#P connect 3 0 0 1;
#P pop;

David

On Feb 22, 2007, at 3:31 PM, Gary Lee Nelson wrote:

> Does anyone use accum? One of my students found it and used in his
> first
> patch. It doesn’t seem to do what I expected and the help and
> manual don’t
> help or man…Is it me or is funky?
>
> Cheers
> Gary Lee Nelson
> Oberlin College
> http://www.timara.oberlin.edu/GaryLeeNelson
>
>

#97303
Feb 23, 2007 at 12:02am

Ah, then it IS funky! The manual should say in big red letters that, unlike
all other max objects inputs to the right must happen before action at the
left-most inlet causes output. I learn once again that blind faith is
dangerous. :-)

On 2/22/07 6:49 PM, “swieser1″ wrote:

>
> it’s a pretty basic object. it’s cleaner than using a bunch of [int] and [+]
> and [*] objects.
>
> try opening the help patch on it. send a value into the left inlet, and that
> will set (and output) the “initial value” stored in the accum object. then,
> send a value into the middle inlet. that value will be added to the “initial
> value”, and then that sum will be stored as the “current value”. however,
> nothing is output until it receives a bang in its left inlet. similarly,
> values sent into the right inlet will multiply the current value.
>
> if your confusion comes from the fact that nothing is output when the object’s
> value changes, then try using a [t b i] object to trigger a bang to the left
> inlet whenever a value is sent to the middle or right inlets.
>
> -scott

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#97304
Apr 1, 2007 at 6:21pm

gimmee back my patchcords you thiefs !!!

OK OK there must have been some copypaste mistake from me ;-)

Thanks for your answers anyway.

Here is the real thing (makes more sense) :

max v2;
#N vpatcher 142 125 1016 663;
#P origin 0 257;
#P window setfont “Sans Serif” 20.;
#P window linecount 1;
#P comment 359 116 314 9109524 …this is not !!??;
#P button 184 156 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 184 177 40 9109513 t b b 0;
#P newex 199 215 40 9109513 uzi 32;
#P newex 199 250 62 9109513 random 8081;
#P number 143 407 67 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 266 291 27 9109513 t i b;
#B color 5;
#P newex 266 352 27 9109513 +;
#B color 5;
#P newex 283 322 27 9109513 0;
#B color 5;
#P number 143 391 74 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 143 358 40 9109513 accum;
#B color 5;
#P number 443 454 67 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 526 334 27 9109513 t i b;
#B color 5;
#P newex 526 398 27 9109513 +;
#B color 5;
#P newex 543 368 27 9109513 0;
#B color 5;
#P newex 525 273 27 9109513 !- 32;
#P number 443 437 74 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 443 403 40 9109513 accum;
#B color 5;
#P newex 368 167 40 9109513 t b b 0;
#P newex 475 302 93 9109513 expr $i1*pow(2\, $i2);
#P button 368 145 15 0;
#P message 475 249 261 9109513 0 0 0 1 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 1 0
0 0 0 0 0 0 0 1 1;
#P newex 383 197 40 9109513 uzi 32;
#P newex 475 273 38 9109513 zl nth 0;
#P window setfont “Sans Serif” 20.;
#P comment 104 116 244 9109524 why is this working while…;
#P fasten 22 2 14 0 219 211 148 211;
#P fasten 22 0 14 0 189 207 148 207;
#P connect 14 0 15 0;
#P fasten 17 0 19 0 271 407 148 407;
#P connect 20 0 14 1;
#P connect 23 0 22 0;
#P connect 22 1 21 0;
#P connect 21 0 20 0;
#P connect 20 0 18 0;
#P connect 18 0 17 0;
#P connect 18 1 16 0;
#P connect 16 0 17 1;
#P fasten 17 0 16 1 271 379 323 379 323 315 305 315;
#P fasten 22 2 16 1 219 202 305 202;
#P connect 4 0 6 0;
#P connect 6 1 2 0;
#P fasten 6 2 7 0 403 192 448 192;
#P fasten 6 0 7 0 373 395 448 395;
#P connect 7 0 8 0;
#P fasten 11 0 13 0 531 452 448 452;
#P connect 5 0 7 1;
#P fasten 2 0 3 0 388 238 480 238;
#P connect 3 0 1 0;
#P connect 1 0 5 0;
#P fasten 2 2 1 1 418 228 508 228;
#P fasten 2 2 9 0 418 222 530 222;
#P connect 5 0 12 0;
#P connect 12 0 11 0;
#P connect 12 1 10 0;
#P connect 10 0 11 1;
#P connect 9 0 5 1;
#P fasten 11 0 10 1 531 425 583 425 583 361 565 361;
#P fasten 6 2 10 1 403 192 565 192;
#P pop;

#97305
Apr 1, 2007 at 7:59pm

At 8:21 PM +0200 4/1/07, raphael seguin wrote:
>gimmee back my patchcords you thiefs !!!

OK, that _is_ strange. It seems like accum, after a certain point, refuses to acknowledge any number less than 16. (in your example it comes after processing step 31)

Here’s your patch set up for single stepping with a bunch of debugging stuff scattered around. This version runs until the accum number and the + number are different. You notice that once it breaks (at step 31) accum is a little wacky. You can bang in numbers < 17 with no output, but numbers >= 17 cause output, as normal.

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 239 216 35 196617 break;
#P user gswitch 239 180 41 32 0 0;
#P hidden message 276 366 14 196617 0;
#P hidden newex 276 346 38 196617 sel 32;
#P message 373 246 20 196617 17;
#P message 348 246 20 196617 16;
#P toggle 318 399 32 0;
#P newex 318 435 32 196617 sel 1;
#P newex 318 376 27 196617 !=;
#P number 354 267 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 381 337 15 0;
#P number 445 308 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 422 287 27 196617 int;
#P button 411 259 15 0;
#P number 434 258 79 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 572 235 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 411 226 15 0;
#P newex 414 308 27 196617 t b i;
#P number 372 183 32 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 14.;
#P message 260 132 61 196622 resume;
#P window setfont “Sans Serif” 9.;
#P message 282 415 35 196617 break;
#P window setfont “Sans Serif” 20.;
#P comment 317 44 314 196628 …this is not !!??;
#P button 52 92 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 52 113 40 196617 t b b 0;
#P newex 67 151 40 196617 uzi 32;
#P newex 67 186 76 196617 random 8081;
#P number 11 343 67 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 134 227 27 196617 t i b;
#B color 5;
#P newex 134 288 27 196617 +;
#B color 5;
#P newex 151 258 27 196617 0;
#B color 5;
#P number 11 327 74 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 11 294 40 196617 accum;
#B color 5;
#P number 402 390 75 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 485 288 27 196617 t i b;
#B color 5;
#P newex 485 334 27 196617 +;
#B color 5;
#P newex 502 311 27 196617 0;
#B color 5;
#P newex 546 209 41 196617 !- 32;
#P number 402 373 80 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 402 339 40 196617 accum;
#B color 5;
#P newex 327 103 40 196617 t b b 0;
#P newex 434 238 122 196617 expr $i1*pow(2\, $i2);
#P button 327 81 15 0;
#P message 434 185 300 196617 0 0 0 1 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1;
#P newex 342 133 40 196617 uzi 32;
#P newex 434 212 52 196617 zl nth 0;
#P window setfont “Sans Serif” 20.;
#P comment 62 44 268 196628 why is this working while…;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 282 183 37 196617 single step;
#P connect 34 0 29 0;
#P connect 34 0 35 0;
#P connect 32 0 34 0;
#P connect 32 0 13 0;
#P fasten 23 2 15 0 87 147 16 147;
#P fasten 23 2 17 1 87 138 173 138;
#P connect 21 0 15 1;
#P connect 21 0 19 0;
#P fasten 18 0 20 0 139 343 16 343;
#P fasten 18 0 17 1 139 315 191 315 191 251 173 251;
#P fasten 12 0 14 0 490 388 407 388;
#P fasten 12 0 11 1 490 361 542 361 542 303 524 303;
#P connect 10 0 6 1;
#P connect 10 0 31 0;
#P hidden connect 7 2 40 0;
#P fasten 7 2 8 0 362 128 407 128;
#P fasten 7 2 11 1 362 128 524 128;
#P connect 3 2 28 0;
#P fasten 3 2 2 1 377 164 481 164;
#P fasten 3 2 10 0 377 158 551 158;
#P connect 3 0 45 2;
#P fasten 3 0 4 0 347 174 439 174;
#P connect 2 0 30 0;
#P connect 2 0 6 0;
#P connect 46 0 3 0;
#P connect 45 0 46 0;
#P hidden connect 44 0 40 0;
#P hidden connect 43 0 44 0;
#P hidden connect 28 0 43 0;
#P connect 41 0 37 0;
#P connect 42 0 37 0;
#P connect 38 0 40 0;
#P fasten 26 0 3 0 287 438 262 438 262 389 309 389 309 198;
#P fasten 39 0 26 0 323 455 278 455 278 404 287 404;
#P connect 40 0 39 0;
#P connect 9 0 38 0;
#P connect 14 0 38 1;
#P connect 37 0 34 0;
#P connect 36 0 8 0;
#P connect 33 0 34 0;
#P connect 29 1 8 1;
#P connect 6 0 32 0;
#P connect 29 0 8 0;
#P connect 27 0 3 0;
#P connect 11 0 12 1;
#P connect 13 1 11 0;
#P connect 13 0 12 0;
#P connect 4 0 2 0;
#P connect 8 0 9 0;
#P fasten 7 0 8 0 332 331 407 331;
#P connect 7 1 3 0;
#P connect 5 0 7 0;
#P connect 17 0 18 1;
#P connect 19 1 17 0;
#P connect 19 0 18 0;
#P connect 22 0 21 0;
#P connect 23 1 22 0;
#P connect 24 0 23 0;
#P connect 15 0 16 0;
#P fasten 23 0 15 0 57 143 16 143;
#P window clipboard copycount 47;


Chris Muir | “There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue.” – Brian Eno

#97306
Apr 1, 2007 at 8:58pm

#97307
Apr 1, 2007 at 9:50pm

I use accum all the time… <3 accum.

#97308

You must be logged in to reply to this topic.