06.more.counters.pd 2.55 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#N canvas 0 0 448 509 10;
#X floatatom 127 209 0 0 0 0 - - -;
#X obj 127 183 + 1;
#X msg 127 79 bang;
#X obj 127 131 metro 500;
#X msg 38 137 stop;
#X obj 127 157 float;
#X obj 127 105 trigger bang bang;
#X msg 226 131 0;
#X obj 38 111 select 10;
#X text 255 131 first set value to zero;
#X text 244 105 initialization is in two steps;
#X text 225 150 (before starting the metronome);
#X text 15 162 conditionally;
#X text 15 179 stop the;
#X text 16 193 metronome;
#X floatatom 25 321 0 0 0 0 - - -;
#X obj 25 347 >= 0;
#X obj 25 373 select 0 1;
#X obj 25 425 float;
#X floatatom 72 451 0 0 0 0 - - -;
#X msg 59 399 bang;
#X obj 72 425 + 1;
#X msg 25 399 -1;
#X text 71 347 <-- are we nonnegative? (1 if true \, 0 if false);
#X text 100 373 <-- selectively bang the first or second outlet;
#X text 100 400 <-- as a result either clear or increment the counter
Miller Puckette's avatar
Miller Puckette committed
28
;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#X text 19 37 Here's a counter that counts from 1 to 10:;
#X obj 1 1 cnv 15 445 20 empty \$0-pddp.cnv.header more_counters 20
10 1 18 -261139 -33289 0;
#X obj 407 2 pddp/pddplink http://puredata.info/dev/pddp -text pddp
;
#X obj 1 487 cnv 15 445 20 empty \$0-pddp.cnv.footer empty 20 12 0
14 -233017 -33289 0;
#N canvas 76 223 494 284 META 0;
#X text 12 105 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 85 LIBRARY PDDP;
#X text 12 5 GENRE tutorial;
#X text 12 45 LICENSE SIBSD;
#X text 12 25 KEYWORDS control;
#X text 12 65 DESCRIPTION examples of simple counters;
#X text 12 125 HELP_PATCH_AUTHORS Miller Puckette. Updated for release
0.34. Jonathan Wilkes revised the patch to conform to the PDDP template
for Pd version 0.42.;
#X restore 382 489 pd META;
#X text 164 79 <-- click here to start;
#N canvas 12 434 428 143 References 0;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -261139 -33289 0;
#X text 7 2 Counter- Related Help Documents;
#X restore 103 489 pd References;
#X obj 6 489 pddp/pddplink ../5.reference/pddp/help.pd -text help;
#X text 33 232 We're using one new object \, [select] \, which outputs
Miller Puckette's avatar
Miller Puckette committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
a bang when it gets a matching value (10). This is useful for doing
conditional computations \, such as this one which counts while its
input is 0 or positive but clears when negative:;
#X connect 1 0 0 0;
#X connect 1 0 5 1;
#X connect 1 0 8 0;
#X connect 2 0 6 0;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 5 0 1 0;
#X connect 6 0 3 0;
#X connect 6 1 7 0;
#X connect 7 0 5 1;
#X connect 8 0 4 0;
69
#X connect 15 0 16 0;
Miller Puckette's avatar
Miller Puckette committed
70
#X connect 16 0 17 0;
71
72
73
74
75
#X connect 17 0 22 0;
#X connect 17 1 20 0;
#X connect 18 0 21 0;
#X connect 20 0 18 0;
#X connect 21 0 18 1;
Miller Puckette's avatar
Miller Puckette committed
76
#X connect 21 0 19 0;
77
#X connect 22 0 18 0;