#N canvas 333 23 731 710 12;
#X declare -stdpath ./;
#X obj 367 224 loadbang;
#X obj 43 365 hip~ 5;
#X obj 516 119 adc~ 1;
#X obj 367 279 soundfiler;
#X obj 43 426 output~;
#X obj 516 176 tabwrite~ E03-table;
#X msg 367 251 read ../sound/voice.wav E03-table;
#X obj 157 231 osc~;
#X obj 89 232 *~;
#X obj 157 180 mtof;
#X obj 157 208 *;
#X msg 206 176 0.5;
#X floatatom 206 205 3 0 0 0 - - - 0;
#X msg 244 176 15;
#X obj 90 255 *~ 2;
#X obj 206 151 loadbang;
#N canvas 414 195 543 299 looper 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array E03-table 44103 float 2;
#X coords 0 1.02 44103 -1.02 200 130 1;
#X restore 257 54 graph;
#X text 265 193 ---- 44103 samples ----;
#X obj 66 115 +~ 1;
#X obj 66 63 phasor~ 1;
#X obj 66 88 *~ 44100;
#X obj 66 144 tabread4~ E03-table;
#X obj 66 170 outlet~;
#X text 112 235 one-second sample reader loop. You can replace this with an adc~ if you want to go live., f 46;
#X connect 2 0 5 0;
#X connect 3 0 4 0;
#X connect 4 0 2 0;
#X connect 5 0 6 0;
#X restore 111 69 pd looper;
#X text 451 230 re-read original sample;
#X obj 527 148 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#N canvas 300 203 576 337 delay 0;
#X obj 43 250 outlet~;
#X obj 42 38 inlet~;
#X obj 43 119 loadbang;
#X obj 42 66 delwrite~ E03-del 40;
#X obj 43 223 delread~ E03-del;
#X obj 43 180 expr 1000*1024/$f1;
#X obj 43 145 samplerate~;
#X text 194 59 write to delay line which has enough memory to hold 40 msec, f 30;
#X text 153 145 get sample rate at load time;
#X text 186 174 divide 1024 by sample rate to give time in seconds \; multiply by 1000 to convert to milliseconds.;
#X text 196 225 read from the delay line at the calculated delay;
#X text 272 274 1024-sample delay;
#X connect 1 0 3 0;
#X connect 2 0 6 0;
#X connect 4 0 0 0;
#X connect 5 0 4 0;
#X connect 6 0 5 0;
#X restore 43 134 pd delay;
#X text 161 272 on/off for original;
#X text 185 334 This patch demonstrates using ring modulation to alias a sound down one octave. The ring modulation itself ("osc~" and multiplier) is easy. (We step it up by a factor of 2 to balance the original better.), f 70;
#X text 187 538 About fiddle~ \, suffice it to say that the third outlet contains (pitch \, amplitude) pairs. We unpack the pitch and strip out any zeros (when fiddle~ fails to find a pitch it outputs zero but we'd rather stick with the most recent good one). This is converted from MIDI to Hertz \, and multiplied by 1/2 to control the modulation oscillator. (You can also try large-ish integers which leave the pitch intact but introduce funny formants.), f 70;
#X text 277 176 <= choose an effect;
#X obj 502 25 declare -stdpath ./;
#X text 496 655 updated for Pd version 0.51;
#X obj 111 127 moses 1;
#X obj 111 99 sigmund~ -npts 2048;
#X text 255 99 track pitch;
#X text 173 125 reject low numbers indicating no pitch found;
#X text 186 386 Harder is getting the fundamental frequency of the original sound. We do this with the complicated "sigmund~" object \, which puts out a stream of analysis data for an incoming signal. The "-npts 2048" argument specifies the analysis window size. The analysis is most closely aligned with what the sound was doing at the middle of the window \, i.e. \, 1024 samples ago. The "pd delay" window delays the signal itself 1024 samples so it will be as tightly synchronized with the analysis data as possible. (If you're doing this on a real-time input \, you might drop the delay and settle for less perfect synchronization.), f 70;
#X text 89 16 OCTAVE DIVIDING BY RING MODULATION;
#X text 551 148 <- record a sample;
#X obj 108 288 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 90 317 *~;
#X obj 61 288 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 43 317 *~;
#X text 133 288 <- and processed sounds;
#X connect 0 0 6 0;
#X connect 1 0 4 0;
#X connect 2 0 5 0;
#X connect 6 0 3 0;
#X connect 7 0 8 1;
#X connect 8 0 14 0;
#X connect 9 0 10 0;
#X connect 10 0 7 0;
#X connect 11 0 12 0;
#X connect 12 0 10 1;
#X connect 13 0 12 0;
#X connect 14 0 34 0;
#X connect 15 0 11 0;
#X connect 16 0 19 0;
#X connect 16 0 27 0;
#X connect 18 0 5 0;
#X connect 19 0 8 0;
#X connect 19 0 36 0;
#X connect 26 1 9 0;
#X connect 27 0 26 0;
#X connect 33 0 34 1;
#X connect 34 0 1 0;
#X connect 35 0 36 1;
#X connect 36 0 1 0;
