#N canvas 477 81 788 630 12;
#X declare -stdpath ./;
#X obj 266 179 line~;
#X obj 266 155 pack 0 50;
#X floatatom 220 54 0 0 0 0 - - - 0;
#X obj 142 116 *~;
#X obj 220 80 / 10;
#X obj 220 104 moses 0;
#X msg 220 128 0;
#X text 258 54 bandwidth;
#X obj 124 149 *~;
#X obj 64 146 sig~ 1;
#X obj 88 203 /~;
#X obj 106 177 +~;
#X text 157 149 X^2;
#X text 136 180 1+X^2;
#X text 123 205 1/(1+X^2);
#X text 34 11 ANOTHER PULSE WIDTH MOD ALGORITHM;
#N canvas 0 0 450 300 (subpatch) 0;
#X array F04-signal 882 float 0;
#X coords 0 1.02 882 -1.02 200 130 1;
#X restore 536 360 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array F04-spectrum 259 float 0;
#X coords 0 1.01 258 -0.008 256 200 1;
#X restore 479 77 graph;
#X text 555 497 ---- 0.02 seconds ----;
#X text 506 276 2;
#X text 537 276 4;
#X text 476 276 0;
#X text 546 301 -- partial number --;
#X text 569 276 6;
#X text 602 276 8;
#X text 630 276 10;
#X text 662 276 12;
#X text 694 276 14;
#X obj 88 294 output~;
#X obj 88 255 hip~;
#N canvas 490 195 571 609 fft 0;
#X obj 51 95 inlet~;
#X obj 256 264 inlet;
#X obj 71 129 rfft~;
#X obj 71 162 *~;
#X obj 102 162 *~;
#X obj 71 192 sqrt~;
#X obj 364 143 block~ 4096 1;
#X obj 71 218 biquad~ 0 0 0 0 1;
#X text 135 130 Fourier series;
#X text 143 179 magnitude;
#X text 141 164 calculate;
#X text 60 23 This subpatch computes the spectrum of the incoming signal
with a (rectangular windowed) FFT. FFTs aren't properly introduced
until much later.;
#X text 115 95 signal to analyze;
#X text 208 211 delay two samples;
#X text 206 229 for better graphing;
#X obj 296 488 samplerate~;
#X obj 283 317 metro 500;
#X obj 283 286 inlet;
#X text 333 286 toggle to graph repeatedly;
#X text 310 264 bang to graph once;
#X obj 71 242 /~ 4096;
#X obj 296 463 bang~;
#X obj 296 511 / 512;
#X obj 51 349 tabwrite~ F04-signal;
#X obj 283 345 tabwrite~ F04-spectrum;
#X obj 296 537 s freq/2;
#X msg 256 375 \; pd dsp 1;
#X connect 0 0 2 0;
#X connect 0 0 23 0;
#X connect 1 0 23 0;
#X connect 1 0 24 0;
#X connect 1 0 26 0;
#X connect 2 0 3 0;
#X connect 2 0 3 1;
#X connect 2 1 4 0;
#X connect 2 1 4 1;
#X connect 3 0 5 0;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 7 0 20 0;
#X connect 15 0 22 0;
#X connect 16 0 23 0;
#X connect 16 0 24 0;
#X connect 17 0 16 0;
#X connect 17 0 26 0;
#X connect 20 0 24 0;
#X connect 21 0 15 0;
#X connect 22 0 25 0;
#X restore 145 257 pd fft;
#X obj 164 232 bng 18 250 50 0 empty empty empty 0 -6 0 8 #fcfcfc #000000
#000000;
#X obj 205 257 tgl 18 0 empty empty empty 0 -6 0 8 #fcfcfc #000000
#000000 0 1;
#X obj 141 89 osc~;
#X text 556 541 updated for Pd version 0.37;
#X text 44 546 NOTE: The PAF algorithm is protected by patents belonging
to IRCAM. Noncommercial use seems to be fine with them but contact
them first if you want to sell something using this.;
#X text 45 504 This is the form of pulse train used in the original
Phase Aligned Formant (PAF) algorithm.;
#X text 44 373 Here we use waveshaping to make another form of pulse
train. This one has a neat spectrum: the partials drop off exponentially
(with the "bandwidth" controlling the rate of dropoff.) In later patches
we'll use a wavetable to do the waveshaping but for simplicity \, it's
done algebraically here. The oscillator runs at half the fundamental
frequency. The symmetry of the waveshaping doubles the frequency of
the output.;
#X text 741 261 0;
#X text 738 74 1;
#X obj 141 64 r freq/2;
#X text 186 232 <= graph once;
#X text 226 256 <= repeatedly;
#X obj 593 22 declare -stdpath ./;
#X connect 0 0 3 1;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 3 0 8 0;
#X connect 3 0 8 1;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 5 1 1 0;
#X connect 6 0 1 0;
#X connect 8 0 11 1;
#X connect 9 0 10 0;
#X connect 9 0 11 0;
#X connect 10 0 29 0;
#X connect 10 0 30 0;
#X connect 11 0 10 1;
#X connect 29 0 28 0;
#X connect 29 0 28 1;
#X connect 31 0 30 1;
#X connect 32 0 30 2;
#X connect 33 0 3 0;
#X connect 40 0 33 0;
