#N canvas 513 32 559 620 10;
#X declare -stdpath ./;
#X obj 3 594 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X obj 3 404 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 3 482 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 3 536 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 121 412 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 121 433 cnv 17 3 17 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 121 456 cnv 17 3 17 empty empty 2 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 119 491 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 183 491 signal;
#X text 236 491 - the pulse train signal;
#X text 171 543 1) float;
#X text 171 558 2) float;
#X text 171 573 3) float;
#X obj 119 513 cnv 17 3 17 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 195 513 bang;
#X text 236 513 - when transition from 0 to 1 occurs;
#X text 148 457 float/signal;
#X text 148 413 float/signal;
#X text 148 435 float/signal;
#X text 236 413 - pulse period (in ms);
#X text 236 435 - pulse width (0-1);
#X text 236 457 - onset phase offset (0-1);
#X text 235 542 - period in ms (default 1000), f 42;
#X text 235 557 - pulse width from 0-1 (default 0.5), f 42;
#X text 235 573 - onset phase offset from 0-1 (default 0), f 42;
#X text 91 88 [train~] generates a pulse signal alternating from on (1) to off (0) at a period given in ms. It also sends a bang when going from 0 to 1 \, so it can be used as a metronome., f 57;
#X text 91 129 A pulse width of 0 has the smallest "on" pulse size (a single sample) \, while a pulse width of 1 has the largest (the entire period except the last sample). The "onset phase" delays the "on" portion by a fraction of the total pulse period.;
#X obj 499 69 cyclone/dsponoff~;
#N canvas 748 119 376 520 example 0;
#X obj 242 136 bng 30 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 68 144 cyclone/sah~;
#X obj 68 384 cyclone/cycle~;
#X obj 68 108 noise~;
#X obj 68 251 cyclone/scale~ -1 1 500 1000;
#X text 133 62 period;
#X text 114 81 ms;
#X obj 137 82 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 48 25 [train~] used to trigger the [sah~] object.;
#X obj 137 109 cyclone/train~ 500;
#X obj 68 420 output~;
#X obj 92 298 cyclone/snapshot~ 1;
#X obj 92 325 nbx 7 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 99 184 cyclone/snapshot~ 1;
#X obj 99 211 nbx 7 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 225 438 declare -stdpath ./;
#X connect 1 0 4 0;
#X connect 1 0 13 0;
#X connect 2 0 10 0;
#X connect 3 0 1 0;
#X connect 4 0 2 0;
#X connect 4 0 11 0;
#X connect 7 0 9 0;
#X connect 9 0 1 1;
#X connect 9 1 0 0;
#X connect 11 0 12 0;
#X connect 13 0 14 0;
#X restore 471 343 pd example;
#X obj 303 301 bng 30 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 232 195 hsl 128 16 0 1 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 306 224 hsl 128 16 0 1 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X text 242 195 pulse width (0-1);
#X text 142 378 0;
#X text 142 296 1;
#X obj 156 301 cyclone/scope~ 131 88 147 3 64 -0.015 1.015 0 0 0 0 205 229 232 74 79 77 96 98 102 0 empty;
#X text 315 224 onset phase (0-1);
#X text 152 213 period;
#X text 133 232 ms;
#X obj 156 270 cyclone/train~ 1000 0.5, f 25;
#X obj 303 245 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 229 245 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 156 233 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#N canvas 828 190 538 383 onset 0;
#X obj 174 307 bng 30 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 63 280 cyclone/train~ 1000;
#X obj 339 304 bng 30 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 228 277 cyclone/train~ 1000;
#X obj 342 225 hsl 128 16 0 1 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X text 351 225 onset phase (0-1);
#X obj 339 250 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 339 187 tgl 25 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X text 75 40 The original object in MAX/MSP has a very weird behaviour for the onset that just seems buggy so it was not ported to Cyclone - though we still have something similar.;
#X text 76 86 It is important to note that the onset does not behave as a "phase offset". The onset is from 0 to 1 \, so an onset of "1" will delay the [train~] object for one period long. You can use it to delay one object and make two of them out of sync.;
#X text 77 142 Play with this example below to see how it goes.;
#X connect 1 1 0 0;
#X connect 3 1 2 0;
#X connect 4 0 6 0;
#X connect 6 0 3 2;
#X connect 7 0 4 0;
#X restore 483 368 pd onset;
#X obj 3 3 ./header train~;
#X text 24 59 Pulse-train generator and metronome;
#X connect 30 0 41 0;
#X connect 31 0 40 0;
#X connect 39 0 35 0;
#X connect 39 1 29 0;
#X connect 40 0 39 2;
#X connect 41 0 39 1;
#X connect 42 0 39 0;
