#N canvas 421 52 731 652 12;
#X declare -stdpath ./;
#X obj 367 224 loadbang;
#X obj 53 365 hip~ 5;
#X obj 516 119 adc~ 1;
#X obj 367 279 soundfiler;
#X obj 53 426 output~;
#X obj 516 176 tabwrite~ E03-table;
#X msg 367 251 read ../sound/voice.wav E03-table;
#X obj 157 233 osc~;
#X obj 100 227 *~;
#X obj 157 180 mtof;
#X obj 157 208 *;
#X msg 206 176 0.5;
#X floatatom 206 205 5 0 0 0 - - - 0;
#X msg 244 176 15;
#X obj 100 255 *~ 2;
#X obj 206 151 loadbang;
#N canvas 264 212 543 299 looper 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array E03-table 48003 float 2;
#A color 0;
#A width 2;
#X coords 0 1.02 48003 -1.02 200 130 1;
#X restore 257 54 graph;
#X obj 66 115 +~ 1;
#X obj 66 63 phasor~ 1;
#X obj 66 88 *~ 48000;
#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 text 265 193 ---- 48003 samples ----;
#X connect 1 0 4 0;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
#X connect 4 0 5 0;
#X restore 111 69 pd looper;
#X obj 527 148 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#N canvas 300 203 546 363 delay 0;
#X obj 85 301 outlet~;
#X obj 101 29 inlet~;
#X obj 101 57 delwrite~ E03-del 40;
#X obj 85 254 delread~ E03-del;
#X obj 85 181 expr 1000*1024/$f1;
#X obj 85 136 samplerate~;
#X text 253 50 write to delay line which has enough memory to hold 40 msec, f 30;
#X text 177 135 get sample rate at load time;
#X text 213 248 read from the delay line at the calculated delay (1024-sample delay), f 36;
#X floatatom 85 215 8 0 0 0 - - - 0;
#X obj 85 110 loadbang;
#X text 230 170 divide 1024 by sample rate to give time in seconds \, multiply by 1000 to convert to milliseconds., f 34;
#X connect 1 0 2 0;
#X connect 3 0 0 0;
#X connect 4 0 9 0;
#X connect 5 0 4 0;
#X connect 9 0 3 0;
#X connect 10 0 5 0;
#X restore 53 154 pd delay;
#X text 173 273 on/off for original;
#X obj 502 25 declare -stdpath ./;
#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 obj 118 288 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 100 317 *~;
#X obj 71 288 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 53 317 *~;
#X text 277 176 <-- choose an effect;
#X text 143 288 <-- and processed sounds;
#X text 551 148 <-- record a sample;
#X text 440 229 re-read original sample:;
#X text 192 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 192 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 193 538 About [sigmund~] \, suffice it to say that the left outlet \, by default \, outputs pitch of the analyzed sound. When it fails to find a pitch \, [sigmund~] outputs -1500 \, so we use [moses] to filter these values. The pitch 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 obj 81 19 cnv 5 5 25 empty empty Octave\ Dividing\ by\ Ring\ Modulation 15 13 0 16 #dfdfdf #202020 0;
#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 26 0;
#X connect 15 0 11 0;
#X connect 16 0 18 0;
#X connect 16 0 22 0;
#X connect 17 0 5 0;
#X connect 18 0 8 0;
#X connect 18 0 28 0;
#X connect 21 1 9 0;
#X connect 22 0 21 0;
#X connect 25 0 26 1;
#X connect 26 0 1 0;
#X connect 27 0 28 1;
#X connect 28 0 1 0;
