#N canvas 513 32 560 668 10;
#X declare -stdpath ./;
#X obj 3 644 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X obj 3 454 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 3 532 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 3 586 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 121 462 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 121 483 cnv 17 3 17 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 121 506 cnv 17 3 17 empty empty 2 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 119 541 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 183 541 signal;
#X text 236 541 - the pulse train signal;
#X text 171 593 1) float;
#X text 171 608 2) float;
#X text 171 623 3) float;
#X obj 119 563 cnv 17 3 17 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 195 563 bang;
#X text 236 563 - when transition from 0 to 1 occurs;
#X text 148 507 float/signal;
#X text 148 463 float/signal;
#X text 148 485 float/signal;
#X text 236 463 - pulse period (in ms);
#X text 236 485 - pulse width (0-1);
#X text 236 507 - onset phase offset (0-1);
#X text 235 592 - period in ms (default 1000), f 42;
#X text 235 607 - pulse width from 0-1 (default 0.5), f 42;
#X text 235 623 - 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 437 296 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 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 449 321 pd onset;
#X obj 3 3 ./header train~;
#X text 24 59 Pulse-train generator and metronome;
#X obj 156 301 cyclone/snapshot~ 1;
#X obj 156 328 tgl 25 0 empty empty empty 0 -8 0 10 #dfdfdf #000000 #000000 0 1;
#X floatatom 156 362 5 0 0 0 - - - 0;
#X obj 409 419 open-else;
#X text 460 391 click;
#X text 71 399 see also:;
#X msg 409 391 pulse~;
#X text 142 396 Plugdata users or those with ELSE can also use [else/pulse~] as an alternative., f 42;
#X connect 30 0 38 0;
#X connect 31 0 37 0;
#X connect 36 0 43 0;
#X connect 36 1 29 0;
#X connect 37 0 36 2;
#X connect 38 0 36 1;
#X connect 39 0 36 0;
#X connect 43 0 44 0;
#X connect 44 0 45 0;
#X connect 49 0 46 0;
