#N canvas 21 90 540 752 12;
#X floatatom 183 91;
#X obj 183 115 mtof;
#X floatatom 340 183;
#X obj 164 431 -~;
#N canvas 391 51 561 806 tables 1;
#X graph graph1 0 -1 1002 1 99 322 499 22;
#X array array1 1002 float;
#X pop;
#X graph graph1 0 -1 882 1 96 684 496 384;
#X array array2 882 float;
#X pop;
#X text 138 326 ---------------- 1002 samples ---------------;
#X text 150 693 ---------------- 0.02 sec ---------------;
#X restore 33 201 pd tables;
#N canvas 104 390 728 408 make-table 0;
#X obj 469 146 cos~;
#X obj 303 146 cos~;
#X obj 255 141 cos~;
#X msg 199 210 bang;
#X obj 255 229 tabwrite~ array1;
#X text 366 79 period is 2000 samples \, twice the table length;
#X msg 94 94 \; pd dsp 1;
#X text 118 286 this network puts a half cycle of a band-limited square wave into the table "array1.";
#X text 114 335 logically the half-cycle is in samples 1 through 1000 \; samples 0 and 1001 are provided so that the 4-point interpolation will work everywhere.;
#X text 401 57 back the phase up one sample;
#X msg 336 56 -0.0005;
#X obj 171 16 loadbang;
#X obj 303 120 *~ 3;
#X obj 468 122 *~ 5;
#X obj 303 171 *~ 0.33333;
#X obj 468 172 *~ -0.2;
#X obj 255 169 *~ -1;
#X msg 171 38 bang;
#X obj 254 80 phasor~ 22.05;
#X obj 255 202 *~ 0.57692;
#X connect 0 0 15 0;
#X connect 1 0 14 0;
#X connect 2 0 16 0;
#X connect 3 0 4 0;
#X connect 10 0 18 1;
#X connect 11 0 17 0;
#X connect 12 0 1 0;
#X connect 13 0 0 0;
#X connect 14 0 19 0;
#X connect 15 0 19 0;
#X connect 16 0 19 0;
#X connect 17 0 10 0;
#X connect 17 0 6 0;
#X connect 17 0 3 0;
#X connect 18 0 2 0;
#X connect 18 0 12 0;
#X connect 18 0 13 0;
#X connect 19 0 4 0;
#X restore 34 224 pd make-table;
#X obj 183 163 sig~;
#X obj 341 283 /~;
#X obj 357 256 clip~ 1 999999;
#X obj 183 218 phasor~;
#X obj 196 301 *~;
#X obj 196 325 clip~ -0.5 0.5;
#X floatatom 183 139;
#X obj 196 397 tabread4~ array1;
#X floatatom 340 135;
#X obj 340 206 * 0.33333;
#X obj 340 159 mtof;
#X text 374 110 band limit (MIDI units);
#X text 220 78 pitch;
#X obj 340 87 loadbang;
#X msg 340 111 130;
#X obj 340 230 sig~;
#X text 246 139 frequency;
#X obj 196 349 *~ 1000;
#X obj 196 373 +~ 501;
#X obj 183 242 -~ 0.5;
#X floatatom 206 441;
#N canvas 159 26 495 266 output 0;
#X obj 338 160 t b;
#X obj 338 110 f;
#X obj 338 60 inlet;
#X text 344 29 mute;
#X obj 338 185 f;
#X msg 425 178 0;
#X msg 338 85 bang;
#X obj 338 135 moses 1;
#X obj 425 153 t b f;
#X obj 397 117 moses 1;
#X obj 83 148 dbtorms;
#X obj 397 92 r master-lvl;
#X obj 83 42 r master-lvl;
#X obj 338 210 s master-lvl;
#X obj 22 181 inlet~;
#X obj 199 41 inlet;
#X text 199 18 level;
#X obj 199 100 s master-lvl;
#X msg 96 65 set \$1;
#X obj 96 89 outlet;
#X msg 214 64 \; pd dsp 1;
#X obj 83 194 line~;
#X obj 22 212 *~;
#X obj 22 241 dac~;
#X obj 83 171 pack 0 50;
#X text 20 158 audio;
#X text 93 110 show level;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 13 0;
#X connect 5 0 13 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 8 0;
#X connect 8 0 5 0;
#X connect 9 1 4 1;
#X connect 10 0 24 0;
#X connect 11 0 1 1;
#X connect 11 0 9 0;
#X connect 12 0 10 0;
#X connect 12 0 18 0;
#X connect 14 0 22 0;
#X connect 15 0 17 0;
#X connect 15 0 20 0;
#X connect 18 0 19 0;
#X connect 21 0 22 1;
#X connect 22 0 23 0;
#X connect 22 0 23 1;
#X connect 24 0 21 0;
#X restore 177 469 pd output;
#X msg 235 441 MUTE;
#X text 276 440 <-- output amplitude;
#X text 27 503 Patch to make an approximately band-limited sawtooth. This is useful if you intend to use sawtooth generators above about 200 Hz. \, perhaps to use any of the techniques shown in the previous four patches.;
#X text 28 562 We generate a perfect square wave at Nyquist/6 \; this will have partials 1 \, 3 \, and 5 \, but the Nyquist frequency at partial 6 will cut off the rest of the partials. This is stored in array1 using the "make-table" subpatch.;
#X text 64 34 BAND-LIMITED SAWTOOTH GENERATOR;
#X obj 43 459 tabwrite~ array2;
#X msg 44 435 bang;
#X text 28 632 Now any time we wish to make a discontinuity in the output signal \, we make it look exactly like the bandlimited square wave looks. We do this by reading through the table we recorded \, carefully adding a "digital" \, non-band-limited \, sawtooth to "array1" so that the discontinuities in the two cancel out and what you have left is the transition in the table.;
#X text 338 737 updated for Pd version 0.26;
#X text 41 409 graph output;
#X connect 0 0 1 0;
#X connect 1 0 12 0;
#X connect 2 0 15 0;
#X connect 3 0 27 0;
#X connect 3 0 33 0;
#X connect 6 0 8 0;
#X connect 6 0 9 0;
#X connect 7 0 10 1;
#X connect 8 0 7 1;
#X connect 9 0 25 0;
#X connect 10 0 11 0;
#X connect 11 0 23 0;
#X connect 12 0 6 0;
#X connect 13 0 3 0;
#X connect 14 0 16 0;
#X connect 15 0 21 0;
#X connect 16 0 2 0;
#X connect 19 0 20 0;
#X connect 20 0 14 0;
#X connect 21 0 7 0;
#X connect 23 0 24 0;
#X connect 24 0 13 0;
#X connect 25 0 10 0;
#X connect 25 0 3 1;
#X connect 26 0 27 1;
#X connect 27 0 26 0;
#X connect 28 0 27 2;
#X connect 34 0 33 0;
