#N canvas 328 34 727 584 10;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-waveform 882 float 0;
#X coords 0 1.02 881 -1.02 200 130 1;
#X restore 511 269 graph;
#X floatatom 47 45 0 0 20 0 - - -;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-env 22050 float 0;
#X coords 0 1.02 22049 -1.02 200 130 1;
#X restore 511 89 graph;
#X obj 47 67 phasor~;
#X obj 19 514 output~;
#X obj 46 113 *~;
#X obj 11 180 -~;
#X obj 10 229 *~;
#X floatatom 61 90 3 0 100 0 - - -, f 3;
#X obj 16 259 min~;
#X floatatom 68 138 3 0 100 0 - - -, f 3;
#X obj 68 161 / 100;
#X floatatom 68 187 3 0 100 0 - - -, f 3;
#X obj 60 394 *~ 2;
#X obj 60 417 min~;
#X obj 110 394 -~ 1;
#X obj 60 366 phasor~ 200;
#X obj 18 485 *~;
#X obj 27 341 tabwrite~ \$0-env;
#X obj 38 321 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 68 210 * -1;
#X obj 69 465 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 61 486 tabwrite~ \$0-waveform;
#X obj 111 417 *~ -3;
#X obj 60 440 -~ 0.5;
#X text 541 404 ----- 0.02 second ----;
#X text 86 44 <-- frequency (Hz.);
#X text 539 222 ----- 0.5 second ------;
#X text 100 87 <-- slope of rise segment. Just multiply this by the
phase to make the segment.;
#X text 132 155 Subtract this to make the phasor cross zero at the
desired point of the cycle.;
#X text 107 188 <-- slope of decay segment.;
#X text 112 205 multiply the phasor (with the zero crossing shifted
as above) by the desired slope \, negating it so the segment points
downward.;
#X text 63 259 minimum of rise and decay segments (makes a triangle
wave);
#X obj 17 282 clip~ 0 1;
#X text 109 281 clip the triangle wave to between 0 and 1 \, to make
the sustain and silent regions.;
#X text 108 136 <-- Duty cycle (end of decay segment as % of cycle.)
;
#X text 60 319 <-- click to graph envelope shape;
#X text 91 464 <-- click to graph audio waveform;
#X text 162 372 this makes a quick-and-dirty triangle wave;
#X text 162 390 as described in the previous patch. It's;
#X text 162 427 to listen to.;
#X text 163 409 used here so we'll have something;
#X obj 1 1 cnv 15 445 20 empty \$0-pddp.cnv.header envelope_generators_from_line_segments
20 10 1 18 -261139 -33289 0;
#X obj 407 2 pddp/pddplink http://puredata.info/dev/pddp -text pddp
;
#X obj 1 677 cnv 15 445 20 empty \$0-pddp.cnv.footer empty 20 12 0
14 -233017 -33289 0;
#N canvas 44 246 494 284 META 0;
#X text 12 125 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 105 AUTHOR Miller Puckette;
#X text 12 85 LIBRARY PDDP;
#X text 12 5 GENRE tutorial;
#X text 12 45 LICENSE SIBSD;
#X text 12 145 HELP_PATCH_AUTHORS Updated for release 0.39. Jonathan
Wilkes revised the patch to conform to the PDDP template for Pd version
0.42.;
#X text 12 25 KEYWORDS signal;
#X text 12 65 DESCRIPTION envelope generators from line segments;
#X restore 392 679 pd META;
#N canvas 13 202 428 190 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 envelope generators- Related Help Documents;
#X text 19 37 Links:;
#X restore 103 679 pd References;
#X obj 6 679 pddp/pddplink ../5.reference/pddp/help.pd -text help;
#X text 97 511 You can make a phasor-generated envelope generator using
[min] and [clip] to combine line segments. Here a rise segment starts
at phase 0 \, and a decay segment passes through zero at a controllable
point (the "duty cycle" \, as a percentage of a cycle.) Each has a
controllable slope (in units per cycle). The resulting triangle wave
(the minimum of the rise and decay segments) is limited to 1 \, thus
making a flat "sustain" segment (unless the rise and decay segments
meet at a value less than one \, in which case there is none). Limiting
below by 0 prevents us from following the decay segment into negative
values. Reasonable values to start with are 6 Hz. frequency \, rise
and decay slope 10 \, duty cycle 75%.;
#X connect 1 0 3 0;
#X connect 3 0 5 0;
#X connect 3 0 6 0;
#X connect 5 0 9 1;
#X connect 6 0 7 0;
#X connect 7 0 9 0;
#X connect 8 0 5 1;
#X connect 9 0 33 0;
#X connect 10 0 11 0;
#X connect 11 0 6 1;
#X connect 12 0 20 0;
#X connect 13 0 14 0;
#X connect 14 0 24 0;
#X connect 15 0 23 0;
#X connect 16 0 13 0;
#X connect 16 0 15 0;
#X connect 17 0 4 0;
#X connect 17 0 4 1;
#X connect 19 0 18 0;
#X connect 20 0 7 1;
#X connect 21 0 22 0;
#X connect 23 0 14 1;
#X connect 24 0 22 0;
#X connect 24 0 17 1;
#X connect 33 0 17 0;
#X connect 33 0 18 0;
