# [PD] Peculiar counter behavior.....

Frank Barknecht fbar at footils.org
Tue Dec 7 09:41:14 CET 2004

```Hallo,
chun lee hat gesagt: // chun lee wrote:

> Its about making simple float accumulator/counter patches. It sometimes
> work, but sometimes not and I can't figure out what makes it work or not
> work.

Two additional remarks: Personally I find it easier to always make int
counters, then modify those as needed. The practical reason is, that
then you can use [mod] which is great for wrapping counters. (I'll let
Mathieu explain the mathematical reasons, which involve the theory of
Enumerability and Countablility. ;)

Second: It took me a while, probably years, to realize, that it will
solve almost any problem with counting, if you do *not* conenct the
main [f] outlet directly to the [+ 1], but instead put the [mod] in
between those two like the right counter in attached patch. It's a
simple change, but in most cases it is the Right Thing to do instead
of fiddling with [sel] and relatives.

Ciao
--
Frank Barknecht                               _ ______footils.org__
-------------- next part --------------
#N canvas 108 177 472 229 10;
#X obj 25 88 f;
#X floatatom 86 66 5 0 0 0 - - -;
#X obj 82 147 sel 1;
#X obj 25 32 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X msg 41 60 0;
#X floatatom 25 122 5 0 0 0 - - -;
#X obj 70 88 + 0.1;
#X obj 82 124 >= 3;
#X obj 189 93 f;
#X obj 189 37 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 25 -5 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 42 -4 <-bang here;
#X msg 204 61 0;
#X floatatom 189 156 5 0 0 0 - - -;
#X obj 189 133 * 0.1;
#X obj 189 113 mod 31;
#X obj 234 94 + 1;
#X text 148 178 Connect [f] to [mod] \, then [mod] to [+ X];
#X connect 0 0 5 0;
#X connect 0 0 6 0;
#X connect 0 0 7 0;
#X connect 1 0 6 1;
#X connect 2 0 4 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 6 0 0 1;
#X connect 7 0 2 0;
#X connect 8 0 15 0;
#X connect 9 0 8 0;
#X connect 10 0 3 0;
#X connect 10 0 9 0;
#X connect 12 0 8 0;
#X connect 14 0 13 0;
#X connect 15 0 14 0;
#X connect 15 0 16 0;
#X connect 16 0 8 1;
```