#N canvas 568 60 532 632 12;
#X declare -stdpath ./;
#N canvas 514 169 716 525 16x 0;
#X obj 35 254 *~ 0.125;
#X obj 35 279 rzero~ -1;
#X obj 35 304 rzero~ -1;
#X obj 35 329 rzero~ -1;
#X obj 35 61 phasor~;
#X obj 228 47 block~ 1024 1 16;
#X obj 35 26 inlet;
#X obj 35 363 outlet~;
#X obj 35 134 rpole~ 0.87467;
#X obj 35 108 *~ 0.12532;
#X obj 35 160 *~ 0.01668;
#X obj 294 323 buttercoef3;
#X floatatom 294 247 7 0 0 0 - - - 0;
#X obj 294 297 / 16;
#X floatatom 294 460 7 0 0 0 - - - 0;
#X obj 294 272 / 22050;
#X floatatom 308 438 7 0 0 0 - - - 0;
#X floatatom 323 416 7 0 0 0 - - - 0;
#X floatatom 338 394 7 0 0 0 - - - 0;
#X floatatom 353 372 7 0 0 0 - - - 0;
#X floatatom 368 350 7 0 0 0 - - - 0;
#X obj 35 187 cpole~ 0.9293 0.10812;
#X obj 35 223 cpole~ 0.9293 -0.10812;
#X msg 294 222 15000;
#X text 344 221 desired cutoff frequency;
#X text 359 266 divide by nyquist frequency of this subpatch \, which is 22050*16 because of the 16-times oversampling., f 36;
#X text 288 190 Here is how to calculate the filter coefficients:;
#X text 163 93 These objects make a 3-pole \, 3-zero Butterworth low-pass filter with cutoff at 15kHz (assuming 16x44100 sample rate). The filter was designed using the [buttercoef3] abstraction introduced in patch H13.butterworth.pd in this series.;
#X text 424 372 (same \, other [cpole~]);
#X text 428 352 coef for [cpole~] imaginary part;
#X text 397 396 coef for [cpole~] real part;
#X text 381 417 coef for [rpole~];
#X text 367 438 normalizer for [cpole~];
#X text 350 461 normalizer for [rpole~];
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 7 0;
#X connect 4 0 9 0;
#X connect 6 0 4 0;
#X connect 8 0 10 0;
#X connect 9 0 8 0;
#X connect 10 0 21 0;
#X connect 11 0 14 0;
#X connect 11 1 16 0;
#X connect 11 2 17 0;
#X connect 11 3 18 0;
#X connect 11 4 19 0;
#X connect 11 5 20 0;
#X connect 12 0 15 0;
#X connect 13 0 11 0;
#X connect 15 0 13 0;
#X connect 21 0 22 0;
#X connect 21 1 22 1;
#X connect 22 0 0 0;
#X connect 23 0 12 0;
#X restore 131 334 pd 16x;
#X floatatom 265 297 8 0 0 0 - - - 0;
#X obj 265 334 phasor~;
#X obj 131 379 output~;
#X obj 265 379 output~;
#X obj 265 271 mtof;
#X floatatom 265 245 5 -24 135 0 - - - 0;
#X text 303 441 not;
#X text 57 544 You can trade off cutoff frequency with foldover. Here \, the filter is set for a cutoff of 15 kHz. Lowering it to 7500 Hz would further reduce foldover by 18 dB at the expense of losing energy in the range 7500-15000 Hz.;
#X obj 81 250 declare -stdpath ./;
#X text 52 75 The [pd 16x] subpatch at left contains a [phasor~] object \, but is locally upsampled by a factor of sixteen. Without upsampling \, partials as low as 24 kHz fold back over into the audible range. With upsampling \, the first audibly folding over partial is at almost 700 Hz \, 29 times higher. The relevant partials will be 29 times \, or almost 30 dB \, quieter when upsampled., f 60;
#X text 57 492 A third-order Butterworth filter is used inside the [pd 16x] subpatch - without that \, the internal signal would fold over as it gets downsampled at the [outlet~] object.;
#X obj 33 27 cnv 5 5 25 empty empty Upsampling\ to\ Control\ Foldover 15 13 0 16 #dfdfdf #202020 0;
#X text 310 245 <-- pitch;
#X text 155 441 16x up- sampled, f 7;
#X obj 265 194 loadbang;
#X msg 265 218 82;
#X connect 0 0 3 0;
#X connect 1 0 0 0;
#X connect 1 0 2 0;
#X connect 2 0 4 0;
#X connect 5 0 1 0;
#X connect 6 0 5 0;
#X connect 15 0 16 0;
#X connect 16 0 6 0;
