diff options
-rw-r--r-- | pwm-help.pd | 54 | ||||
-rw-r--r-- | pwm.pd | 123 |
2 files changed, 116 insertions, 61 deletions
diff --git a/pwm-help.pd b/pwm-help.pd new file mode 100644 index 0000000..13cd764 --- /dev/null +++ b/pwm-help.pd @@ -0,0 +1,54 @@ +#N canvas 172 95 530 434 10; +#X text 140 148 the argument sets the frequency; +#X obj 88 102 tgl 15 0 empty empty empty 0 -6 0 8 -24198 -1 -1 1 1 +; +#X obj 142 96 hsl 128 15 0 1 0 0 empty empty amount -2 -6 1 12 -261681 +-1 -1 11100 1; +#X floatatom 149 118 5 0 0 0 - - -; +#X text 14 20 this object does Pulse Width Modulation at the message +rate:; +#X text 3 101 turn on/off; +#X obj 77 397 pddp/pddplink http://en.wikipedia.org/wiki/Pulse-width_modulation +; +#X text 17 376 for more info:; +#N canvas 0 0 450 300 graph1 0; +#X array \$0-pwm 200 float 0; +#X coords 0 1.2 199 -0.2 200 140 1; +#X restore 284 202 graph; +#N canvas 727 94 454 304 display 0; +#X obj 115 35 inlet; +#X obj 117 265 tabwrite \$0-pwm; +#X obj 238 127 float; +#X obj 281 127 + 1; +#X obj 275 157 arraysize \$0-pwm; +#X obj 250 31 inlet; +#X obj 356 110 bang; +#X obj 258 181 mod; +#X obj 116 103 spigot; +#X obj 118 239 float; +#X obj 194 204 trigger bang float; +#X obj 237 105 metro 3; +#X connect 0 0 8 0; +#X connect 2 0 7 0; +#X connect 3 0 2 1; +#X connect 4 0 7 1; +#X connect 5 0 6 0; +#X connect 5 0 8 1; +#X connect 5 0 11 0; +#X connect 6 0 4 0; +#X connect 7 0 3 0; +#X connect 7 0 10 0; +#X connect 8 0 9 1; +#X connect 9 0 1 0; +#X connect 10 0 9 0; +#X connect 10 1 1 1; +#X connect 11 0 2 0; +#X restore 95 310 pd display guts; +#X obj 195 283 tgl 15 0 empty empty display 0 -6 0 8 -225271 -1 -1 +1 1; +#X obj 96 147 pwm 10; +#X connect 1 0 11 0; +#X connect 2 0 3 0; +#X connect 2 0 11 1; +#X connect 10 0 9 1; +#X connect 11 0 9 0; @@ -1,66 +1,67 @@ -#N canvas 28 81 655 590 10; -#X msg 331 412 0; -#X msg 280 413 1; -#X text 404 362 duty cycle; -#X obj 307 442 f; -#X obj 179 31 inlet; -#X obj 379 32 inlet; -#X text 219 31 start/stop; -#X text 422 33 speed (0-1); -#X obj 349 385 delay; -#X obj 280 147 select 1; -#X obj 331 169 bang; -#X obj 179 106 t f f; -#X obj 280 233 oneshot; -#X msg 288 210 clear; -#X obj 172 333 spigot; -#X obj 172 291 bang; -#X obj 515 137 f \$1; -#X obj 529 225 /; -#X obj 515 180 t b f; -#X msg 515 201 1000; -#X obj 515 109 loadbang; -#X obj 172 311 delay 100; -#X obj 379 362 *; -#X obj 379 89 max 0; -#X obj 379 67 min 1; -#X obj 395 337 r \$0-cycle_ms; -#X obj 529 264 s \$0-cycle_ms; -#X obj 230 290 r \$0-cycle_ms; +#N canvas 217 60 497 563 10; +#X msg 208 411 0; +#X msg 157 412 1; +#X text 281 361 duty cycle; +#X obj 184 441 f; +#X obj 56 30 inlet; +#X obj 256 31 inlet; +#X text 96 30 start/stop; +#X obj 226 384 delay; +#X obj 157 146 select 1; +#X obj 208 168 bang; +#X obj 56 105 t f f; +#X obj 157 232 oneshot; +#X msg 165 209 clear; +#X obj 49 332 spigot; +#X obj 49 290 bang; +#X obj 304 246 /; +#X obj 290 201 t b f; +#X msg 290 222 1000; +#X obj 290 130 loadbang; +#X obj 49 310 delay 100; +#X obj 256 361 *; +#X obj 256 88 max 0; +#X obj 256 66 min 1; +#X obj 272 336 r \$0-cycle_ms; +#X obj 304 285 s \$0-cycle_ms; +#X obj 107 289 r \$0-cycle_ms; #X text 27 8 argument = pwm rate in Hz; -#X obj 515 156 abs; -#X obj 307 494 outlet; -#X text 126 533 TODO: needs to have default pwm rate if none is set +#X obj 290 177 abs; +#X obj 184 493 outlet; +#X text 228 533 released under the GNU GPL; +#X text 14 517 (C) Copyright 2006 Hans-Christoph Steiner <hans@at.or.at> ; +#X text 299 32 pulse width (0-1); +#X obj 290 154 purepd/float_argument \$1 30; #X connect 0 0 3 0; #X connect 1 0 3 0; -#X connect 1 0 15 0; -#X connect 3 0 30 0; -#X connect 4 0 11 0; -#X connect 5 0 24 0; -#X connect 8 0 0 0; +#X connect 1 0 14 0; +#X connect 3 0 28 0; +#X connect 4 0 10 0; +#X connect 5 0 22 0; +#X connect 7 0 0 0; +#X connect 8 0 11 0; +#X connect 8 1 9 0; +#X connect 9 0 0 0; #X connect 9 0 12 0; -#X connect 9 1 10 0; -#X connect 10 0 0 0; -#X connect 10 0 13 0; -#X connect 11 0 9 0; -#X connect 11 1 14 1; -#X connect 12 0 1 0; -#X connect 12 0 8 0; -#X connect 13 0 12 0; -#X connect 14 0 8 0; -#X connect 14 0 1 0; -#X connect 15 0 21 0; -#X connect 16 0 29 0; -#X connect 17 0 26 0; -#X connect 18 0 19 0; -#X connect 18 1 17 1; -#X connect 19 0 17 0; -#X connect 20 0 16 0; -#X connect 21 0 14 0; -#X connect 22 0 8 1; -#X connect 23 0 22 0; -#X connect 24 0 23 0; -#X connect 25 0 22 1; -#X connect 27 0 21 1; -#X connect 29 0 18 0; +#X connect 10 0 8 0; +#X connect 10 1 13 1; +#X connect 11 0 1 0; +#X connect 11 0 7 0; +#X connect 12 0 11 0; +#X connect 13 0 7 0; +#X connect 13 0 1 0; +#X connect 14 0 19 0; +#X connect 15 0 24 0; +#X connect 16 0 17 0; +#X connect 16 1 15 1; +#X connect 17 0 15 0; +#X connect 18 0 32 0; +#X connect 19 0 13 0; +#X connect 20 0 7 1; +#X connect 21 0 20 0; +#X connect 22 0 21 0; +#X connect 23 0 20 1; +#X connect 25 0 19 1; +#X connect 27 0 16 0; +#X connect 32 0 27 0; |