#N canvas 461 23 563 640 10;
#X declare -stdpath ./;
#X obj 6 613 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X obj 6 459 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 6 539 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 6 575 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 107 469 cnv 17 3 34 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 107 549 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 136 467 signal;
#X obj 107 510 cnv 17 3 17 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X text 136 509 signal;
#X text 136 549 signal;
#X text 123 586 1) float;
#X text 142 487 float;
#X text 196 509 - trigger signal;
#X text 196 549 - sampled and held signal according to trigger signal;
#X text 196 586 - threshold value (default 0);
#X floatatom 209 244 8 0 0 0 - - - 0;
#X obj 152 230 noise~;
#X obj 152 348 cyclone/cycle~;
#X obj 307 237 cyclone/triangle~ 1;
#X obj 307 287 cyclone/snapshot~ 1;
#X obj 307 318 vsl 20 70 -1 1 0 0 empty empty empty 0 -9 0 10 #f0f0f0 #000000 #000000 0 1;
#X obj 307 214 phasor~ 0.7;
#X obj 348 318 vsl 20 70 -0.99 0.99 0 0 empty empty empty 0 -9 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 209 217 r \$0-thresh;
#X obj 348 397 s \$0-thresh;
#X obj 152 317 expr~ $v1 * 300 + 800;
#X text 86 170 Sample and hold random values from a noise input \, rescaled to 500 - 1100 Hz range:;
#X text 328 383 -1;
#X text 333 309 1;
#X text 334 346 0;
#X text 196 468 - input signal to sample and hold;
#X text 382 349 <= set threshold;
#X text 320 260 <= trigger signal;
#X text 92 255 input =>;
#X obj 152 280 cyclone/sah~ -0.5;
#X text 85 91 When a trigger signal raises above a given threshold \, [sah~] captures a value ("samples") from the input and continually outputs it ("hold") until the trigger signal rises again above the threshold after having dropped below it. This usually synchronizes one signal to the behavior of another.;
#X text 196 488 - sets threshold value;
#N canvas 804 23 469 642 arpeggiator 0;
#X obj 83 437 cyclone/cycle~;
#X floatatom 92 217 0 0 0 0 - - - 0;
#X floatatom 257 206 5 0 0 0 - - - 0;
#X obj 260 182 hsl 128 15 50 150 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 95 194 hsl 128 15 15 25 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 122 302 cyclone/sah~;
#X text 309 269 phasor~;
#X text 287 499 sampled & held;
#X text 306 513 phasor~;
#X text 393 479 0;
#X text 393 393 1;
#X text 395 375 0;
#X text 395 292 1;
#X obj 92 246 phasor~ 20;
#X obj 257 229 cyclone/train~ 77;
#X obj 272 295 cyclone/scope~ 116 89 34 3 128 0 1 0 0 0 0 205 229 232 74 79 77 96 98 102 0 empty;
#X obj 274 400 cyclone/scope~ 116 89 34 3 128 0 1 0 0 0 0 205 229 232 74 79 77 96 98 102 0 empty;
#X obj 83 401 cyclone/scale~ 0 1 200 1000;
#X text 69 19 Here we're passing the signal of a [phasor~] (a periodic ramp from 0-1) through the [sah~] object. The trigger signal is from the [train~] object \, which goes from 0 to 1 at a period given in ms \, and from 1 to 0 at half this period. When [train~] goes from 0 to 1 \, it triggers the [sah~] object.;
#X text 70 106 When the period of the [phasor~] and [train~] are out of synchrony \, you may get interesting arpeggio effects. You can try other waveforms for the input to the [sah~].;
#X text 52 563 The [samphold~] object in Pd vanilla was designed to work with [phasor~]. Conversely \, [sah~] doesn't work well with [phasor~] and works better synchronizing with a signal like a square wave \, or an impulse for example.;
#X obj 83 484 output~;
#X connect 0 0 21 0;
#X connect 1 0 13 0;
#X connect 2 0 14 0;
#X connect 3 0 2 0;
#X connect 4 0 1 0;
#X connect 5 0 16 0;
#X connect 5 0 17 0;
#X connect 13 0 5 0;
#X connect 13 0 15 0;
#X connect 14 0 5 1;
#X connect 17 0 0 0;
#X restore 448 410 pd arpeggiator \; example;
#X obj 499 69 cyclone/dsponoff~;
#X obj 152 383 output~;
#X obj 2 3 ./header sah~;
#X text 21 64 Sample and hold;
#X obj 20 393 declare -stdpath ./;
#X connect 15 0 34 0;
#X connect 16 0 34 0;
#X connect 17 0 39 0;
#X connect 18 0 19 0;
#X connect 18 0 34 1;
#X connect 19 0 20 0;
#X connect 21 0 18 0;
#X connect 22 0 24 0;
#X connect 23 0 15 0;
#X connect 25 0 17 0;
#X connect 34 0 25 0;
