#N canvas 456 23 742 699 12;
#X declare -stdpath ./;
#N canvas 0 0 450 300 (subpatch) 0;
#X array E02-signal 882 float 0;
#X coords 0 5 882 -5 200 130 1;
#X restore 482 84 graph;
#X obj 115 370 hip~ 5;
#N canvas 0 0 450 300 (subpatch) 0;
#X array E02-spectrum 128 float 0;
#X coords 0 4300 127 -40 257 130 1;
#X restore 403 280 graph;
#X text 500 215 ---- 0.02 seconds ----;
#X obj 189 348 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X obj 115 411 output~;
#X text 474 670 updated for Pd version 0.37;
#X text 434 413 1;
#X text 468 413 2;
#X text 500 413 3;
#X text 532 413 4;
#X text 565 413 5;
#X text 595 413 6;
#X text 626 413 7;
#X text 402 413 0;
#X text 457 432 -- partial number --;
#X text 684 138 0;
#X obj 116 54 r fundamental;
#X obj 29 112 osc~;
#X obj 29 162 *~;
#X obj 73 112 osc~;
#X obj 73 162 *~;
#X obj 116 112 osc~;
#X obj 116 162 *~;
#X obj 116 89 * 2;
#X obj 159 112 osc~;
#X obj 159 162 *~;
#X obj 202 112 osc~;
#X obj 202 162 *~;
#X obj 245 112 osc~;
#X obj 245 162 *~;
#X obj 29 89 * 0;
#X obj 73 89 * 1;
#X obj 159 89 * 3;
#X obj 202 89 * 4;
#X obj 245 89 * 5;
#X text 572 55 WAVEFORM;
#X text 514 257 SPECTRUM;
#X text 663 396 0;
#X text 661 275 1;
#X text 662 334 0.5;
#X text 684 78 5;
#X text 685 198 -5;
#X obj 116 239 *~;
#X text 307 120 partials;
#X obj 234 270 osc~;
#X floatatom 234 210 4 0 200 0 - - - 0;
#X obj 234 239 *;
#X obj 267 239 r freq-step;
#X text 306 177 modulation;
#X text 302 192 frequency in;
#X text 42 14 RING MODULATION: multiplying a complex tone by a sinusoid;
#X obj 189 303 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 189 325 metro 500;
#X text 63 489 Now we ring modulate the signal by multiplying it by another sinusoid. The modulation frequency is controlled in steps of f/16 where "f" is the fundamental frequency \, giving roughly 11 Hz. per step. Note that if the modulation frequency is set to zero we can't predict the overall amplitude because it depends on what phase the modulation oscillator happened to have at that moment., f 89;
#X text 63 568 If you choose a multiple of the fundamental as a modulation frequency (16 \, 32 \, 48 \, 64 \, ... "steps") the result is again periodic at the original frequency. If you select a half-integer times the fundamental (8 \, 24 \, 40 \, ... steps) the pitch drops by an octave and you get only odd partials. For most other settings you'll get an inharmonic complex of tones. These are sometimes heard as separate pitches and other times they seem to fuse into a single timbre with indeterminate pitch., f 89;
#N canvas 436 82 601 665 fft 0;
#X obj 86 90 inlet~;
#X obj 162 243 inlet;
#X obj 96 121 rfft~;
#X obj 96 154 *~;
#X obj 127 154 *~;
#X obj 96 184 sqrt~;
#X obj 399 138 block~ 4096 1;
#X obj 96 210 biquad~ 0 0 0 0 1;
#X text 160 122 Fourier series;
#X text 165 175 magnitude;
#X text 163 160 calculate;
#X text 64 24 This subpatch computes the spectrum of the incoming signal with a (rectangular windowed) FFT. FFTs aren't properly introduced until much later.;
#X text 150 90 signal to analyze;
#X text 235 202 delay two samples;
#X text 234 218 for better graphing;
#X obj 91 466 samplerate~;
#X obj 91 443 bng 18 250 50 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000;
#X floatatom 91 523 5 0 0 0 - - - 0;
#X obj 91 499 / 256;
#X obj 91 419 loadbang;
#X floatatom 91 592 5 0 0 0 - - - 0;
#X obj 99 545 s fundamental;
#X obj 91 568 ftom;
#X text 70 353 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 212 245 "bang" into this inlet to graph it;
#X floatatom 230 531 5 0 0 0 - - - 0;
#X obj 230 507 / 4096;
#X text 226 476 One bin is SR/4096:;
#X obj 230 553 s freq-step;
#X obj 162 277 tabwrite~ E02-spectrum;
#X obj 87 310 tabwrite~ E02-signal;
#X text 147 591 <= just out of curiosity \, here's the fundamental pitch;
#X connect 0 0 2 0;
#X connect 0 0 30 0;
#X connect 1 0 29 0;
#X connect 1 0 30 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 29 0;
#X connect 15 0 18 0;
#X connect 15 0 26 0;
#X connect 16 0 15 0;
#X connect 17 0 21 0;
#X connect 17 0 22 0;
#X connect 18 0 17 0;
#X connect 19 0 16 0;
#X connect 22 0 20 0;
#X connect 25 0 28 0;
#X connect 26 0 25 0;
#X restore 128 337 pd fft;
#X obj 569 17 declare -stdpath ./;
#X text 212 302 <-- graph repeatedly;
#X text 212 347 <-- graph once;
#X text 268 209 <-- "steps" of f/16;
#X text 289 136 <-- On/Off;
#X obj 47 137 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 91 137 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 134 137 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 177 137 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 220 137 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 263 137 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X connect 1 0 5 0;
#X connect 4 0 56 1;
#X connect 17 0 31 0;
#X connect 17 0 32 0;
#X connect 17 0 24 0;
#X connect 17 0 33 0;
#X connect 17 0 34 0;
#X connect 17 0 35 0;
#X connect 18 0 19 0;
#X connect 19 0 43 0;
#X connect 20 0 21 0;
#X connect 21 0 43 0;
#X connect 22 0 23 0;
#X connect 23 0 43 0;
#X connect 24 0 22 0;
#X connect 25 0 26 0;
#X connect 26 0 43 0;
#X connect 27 0 28 0;
#X connect 28 0 43 0;
#X connect 29 0 30 0;
#X connect 30 0 43 0;
#X connect 31 0 18 0;
#X connect 32 0 20 0;
#X connect 33 0 25 0;
#X connect 34 0 27 0;
#X connect 35 0 29 0;
#X connect 43 0 1 0;
#X connect 43 0 56 0;
#X connect 45 0 43 1;
#X connect 46 0 47 0;
#X connect 47 0 45 0;
#X connect 48 0 47 1;
#X connect 52 0 53 0;
#X connect 53 0 4 0;
#X connect 62 0 19 1;
#X connect 63 0 21 1;
#X connect 64 0 23 1;
#X connect 65 0 26 1;
#X connect 66 0 28 1;
#X connect 67 0 30 1;
