#N canvas 452 23 764 821 12;
#N canvas 0 0 450 300 (subpatch) 0;
#X array E01-signal 882 float 0;
#X coords 0 5 882 -5 200 130 1;
#X restore 460 43 graph;
#X obj 133 311 hip~ 5;
#N canvas 0 0 450 300 (subpatch) 0;
#X array E01-spectrum 128 float 0;
#X coords 0 4300 127 -40 257 130 1;
#X restore 416 239 graph;
#N canvas 436 82 525 608 fft 0;
#X obj 45 77 inlet~;
#X obj 111 229 inlet;
#X obj 45 107 rfft~;
#X obj 45 140 *~;
#X obj 76 140 *~;
#X obj 45 170 sqrt~;
#X obj 111 263 tabwrite~ E01-spectrum;
#X obj 332 109 block~ 4096 1;
#X obj 45 196 biquad~ 0 0 0 0 1;
#X text 109 108 Fourier series;
#X text 114 161 magnitude;
#X text 112 146 calculate;
#X text 38 9 This subpatch computes the spectrum of the incoming signal
with a (rectangular windowed) FFT. FFTs aren't properly introduced
until much later.;
#X text 109 77 signal to analyze;
#X text 181 188 delay two samples;
#X text 180 204 for better graphing;
#X obj 106 433 samplerate~;
#X obj 106 410 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X floatatom 106 480 5 0 0 0 - - -;
#X obj 106 456 / 256;
#X obj 106 386 loadbang;
#X floatatom 106 549 5 0 0 0 - - -;
#X obj 114 502 s fundamental;
#X obj 106 525 ftom;
#X text 31 314 At load time \, calculate a good choice of fundamental
frequency for showing spectra: the 16th bin in a 4096-point spectrum
\, so SR*16/4096 or SR/256., f 62;
#X text 161 231 "bang" into this inlet to graph it;
#X text 148 549 <= just out of curiosity \, here's the pitch;
#X connect 0 0 2 0;
#X connect 1 0 6 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 8 0;
#X connect 8 0 6 0;
#X connect 16 0 19 0;
#X connect 17 0 16 0;
#X connect 18 0 22 0;
#X connect 18 0 23 0;
#X connect 19 0 18 0;
#X connect 20 0 17 0;
#X connect 23 0 21 0;
#X restore 144 286 pd fft;
#X text 480 175 ---- 0.02 seconds ----;
#X obj 204 251 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 133 345 output~;
#X obj 204 286 tabwrite~ E01-signal;
#X text 533 780 updated for Pd version 0.37;
#X text 447 372 1;
#X text 481 372 2;
#X text 513 372 3;
#X text 545 372 4;
#X text 578 372 5;
#X text 608 372 6;
#X text 639 372 7;
#X text 415 372 0;
#X text 462 391 -- partial number --;
#X text 662 99 0;
#X obj 135 56 r fundamental;
#X obj 49 118 osc~;
#X obj 67 143 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 49 168 *~;
#X obj 92 118 osc~;
#X obj 110 143 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 92 168 *~;
#X obj 135 118 osc~;
#X obj 153 143 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 135 168 *~;
#X obj 135 95 * 2;
#X obj 178 118 osc~;
#X obj 196 143 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 178 168 *~;
#X obj 221 118 osc~;
#X obj 239 143 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 221 168 *~;
#X obj 264 118 osc~;
#X obj 282 143 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X obj 264 168 *~;
#X obj 49 95 * 0;
#X obj 92 95 * 1;
#X obj 178 95 * 3;
#X obj 221 95 * 4;
#X obj 264 95 * 5;
#X text 325 159 for each;
#X text 327 175 partial;
#X text 547 13 WAVEFORM;
#X text 509 217 SPECTRUM;
#X text 79 437 The next series of patches demonstrates various kinds
of modulation: AM \, waveshaping \, and FM. We will need a tool for
graphing spectra which is introduced here. In this patch the signal
to be analyzed is a simple sum of up to six partials of a fundamental
frequency (which is 172 Hz \, close to F below middle C \, if your
sample rate happens to be 44100 Hz. The fundamental is chosen to agree
with the analysis patch ("pd FFT") and is computed within it)., f
75;
#X text 80 545 The partials are numbered 0 through 5 \, where 0 means
DC \, or zero frequency \, 1 is the fundamental \, and so on. The toggle
switches allow you to turn them on and off separately. You have to
press the "click to graph" button to update the two graphs., f 75
;
#X text 676 357 0;
#X text 674 236 1;
#X text 675 295 0.5;
#X text 80 611 The upper graph is just the (time domain) waveform \,
about four periods long. The lower graph is the magnitude spectrum.
Its peaks are the magnitudes of the partials. Note that a DC signal
of amplitude one is considered a partial of magnitude 1 \, but the
other partials \, which have peak amplitudes of 1 (and RMS 0.707) \,
have peak magnitudes of only 0.5 in the spectrum., f 75;
#X obj 134 229 *~ 1;
#X text 662 39 5;
#X text 663 159 -5;
#X text 174 228 sum;
#X text 57 11 GRAPHING SPECTRA OF AUDIO SIGNALS;
#X text 80 705 Here we're introducing a new feature: multiple signals
connected to a signal inlet (as in the "*~ 1") are added. This is the
most convenient way to sum the six partials., f 75;
#X text 227 250 <= click to graph;
#X text 306 143 <= On/Off;
#X connect 1 0 6 0;
#X connect 1 0 6 1;
#X connect 5 0 3 1;
#X connect 5 0 7 0;
#X connect 19 0 39 0;
#X connect 19 0 40 0;
#X connect 19 0 29 0;
#X connect 19 0 41 0;
#X connect 19 0 42 0;
#X connect 19 0 43 0;
#X connect 20 0 22 0;
#X connect 21 0 22 1;
#X connect 22 0 54 0;
#X connect 23 0 25 0;
#X connect 24 0 25 1;
#X connect 25 0 54 0;
#X connect 26 0 28 0;
#X connect 27 0 28 1;
#X connect 28 0 54 0;
#X connect 29 0 26 0;
#X connect 30 0 32 0;
#X connect 31 0 32 1;
#X connect 32 0 54 0;
#X connect 33 0 35 0;
#X connect 34 0 35 1;
#X connect 35 0 54 0;
#X connect 36 0 38 0;
#X connect 37 0 38 1;
#X connect 38 0 54 0;
#X connect 39 0 20 0;
#X connect 40 0 23 0;
#X connect 41 0 30 0;
#X connect 42 0 33 0;
#X connect 43 0 36 0;
#X connect 54 0 3 0;
#X connect 54 0 1 0;
#X connect 54 0 7 0;
