#N canvas 777 23 549 567 12;
#X declare -stdpath ./;
#N canvas 140 422 1188 313 peaks-list 1;
#X coords 0 313 1 312 0 0 0;
#X restore 389 365 pd peaks-list;
#X text 325 367 display:;
#N canvas 365 100 537 353 add-peaks 0;
#X obj 288 217 pointer;
#X obj 221 197 rmstodb;
#X obj 288 136 t b b;
#X msg 340 129 \; pd-peaks-list clear;
#X msg 288 181 traverse pd-peaks-list \, bang;
#X obj 221 223 * 3;
#X msg 154 216 20;
#X obj 73 28 inlet;
#X obj 88 252 append peaks-template x y amp;
#X obj 73 155 unpack f f f;
#X text 71 293 see result in the 'peaks-list' subwindow;
#X obj 288 67 bang~;
#X obj 350 68 block~ 4096;
#X obj 88 215 * 0.1;
#X text 99 63 This subpatch uses 'peaks' information from [sigmund~] to draw FFT peaks with data structures., f 19;
#X obj 340 102 loadbang;
#X connect 0 0 8 3;
#X connect 1 0 5 0;
#X connect 2 0 4 0;
#X connect 2 1 3 0;
#X connect 4 0 0 0;
#X connect 5 0 8 2;
#X connect 6 0 8 1;
#X connect 7 0 9 0;
#X connect 9 1 13 0;
#X connect 9 2 6 0;
#X connect 9 2 1 0;
#X connect 11 0 2 0;
#X connect 13 0 8 0;
#X connect 15 0 3 0;
#X restore 101 532 pd add-peaks;
#X obj 340 91 bng 22 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 299 533 updated for Pd version 0.53-1;
#X text 368 93 record live input;
#X obj 489 153 bng 22 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X text 380 134 or even...;
#X text 405 169 sample;
#X obj 43 143 openpanel;
#X obj 43 90 bng 22 250 50 0 empty empty 1st 31 11 0 20 #dfdfdf #000000 #000000;
#N canvas 249 241 830 334 sample 0;
#N canvas 0 50 450 300 (subpatch) 0;
#X array sample1 155944 float 2;
#X coords 0 1 155944 -1 453 90 1 0 0;
#X restore 350 68 graph;
#X obj 119 121 r resize-sample;
#X obj 119 156 t f b;
#X obj 151 187 samplerate~;
#X obj 151 212 / 1000;
#X obj 119 201 *;
#X obj 26 17 inlet;
#N canvas 441 320 449 241 record 0;
#X obj 37 37 inlet;
#X obj 53 145 adc~ 1;
#X text 191 91 (set array size to 3 seconds);
#X msg 52 77 \; resize-sample 3000 \; pd dsp 1;
#X obj 37 182 tabwrite~ sample1;
#X connect 0 0 3 0;
#X connect 0 0 4 0;
#X connect 1 0 4 0;
#X restore 122 66 pd record;
#X obj 72 17 inlet;
#X obj 122 16 inlet;
#X obj 216 17 inlet;
#N canvas 265 240 284 293 load 0;
#X obj 55 34 inlet;
#X obj 55 226 soundfiler;
#X msg 109 144 \; pd dsp 1;
#X obj 109 34 inlet;
#X msg 109 99 symbol ../sound/\$1;
#X obj 109 69 symbol;
#X msg 55 195 read -resize \$1 sample1;
#X connect 0 0 6 0;
#X connect 0 0 2 0;
#X connect 3 0 5 0;
#X connect 4 0 6 0;
#X connect 4 0 2 0;
#X connect 5 0 4 0;
#X connect 6 0 1 0;
#X restore 26 66 pd load;
#N canvas 362 36 579 430 synthesis 0;
#X obj 68 113 osc~ 110;
#X obj 68 165 *~;
#X obj 68 209 +~ 0.2;
#X obj 68 241 cos~;
#X obj 68 284 *~;
#X obj 199 31 inlet;
#X obj 134 188 vline~;
#X obj 308 188 vline~;
#X text 251 277 This creates a waveshaping synthesis sample., f 26;
#X msg 317 86 \; resize-sample 2500 \; pd dsp 1 \, fast-forward 2500;
#X msg 134 148 0 \, 2 500 \, 0.05 1500 500;
#X msg 308 148 0 \, 1 100 \, 0 2250 250;
#X obj 199 365 tabwrite~ sample1;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 12 0;
#X connect 5 0 10 0;
#X connect 5 0 11 0;
#X connect 5 0 9 0;
#X connect 5 0 12 0;
#X connect 6 0 1 1;
#X connect 7 0 4 1;
#X connect 10 0 6 0;
#X connect 11 0 7 0;
#X restore 216 66 pd synthesis;
#X obj 423 209 declare -stdpath ./;
#X msg 298 207 25;
#X obj 298 182 loadbang;
#X obj 298 231 s npeaks;
#X msg 119 238 \; sample1 resize \$1;
#X connect 1 0 2 0;
#X connect 2 0 5 0;
#X connect 2 1 3 0;
#X connect 3 0 4 0;
#X connect 4 0 5 1;
#X connect 5 0 17 0;
#X connect 6 0 11 0;
#X connect 8 0 11 1;
#X connect 9 0 7 0;
#X connect 10 0 12 0;
#X connect 14 0 16 0;
#X connect 15 0 14 0;
#X coords 0 -1 1 1 453 108 2 350 50;
#X restore 43 193 pd sample;
#N canvas 395 221 458 221 peaks-template 0;
#X obj 59 81 filledpolygon 3 3 3 0 0 0 amp 0 0;
#X obj 58 41 struct peaks-template float x float y float amp;
#X text 55 131 This is a template for ploting FFT amplitude peaks \, where a polygon is drawn for all peaks., f 46;
#X restore 389 337 pd peaks-template;
#X text 380 153 synthesize -->;
#X msg 207 168 voice2.wav;
#X msg 200 145 voice.wav;
#X msg 191 122 bell.aiff;
#X text 381 110 (3 seconds);
#X text 133 143 choose:;
#X text 33 67 browse:;
#X text 112 92 - browse/choose soundfile or ->;
#X floatatom 28 410 5 1 50 0 - npkeak - 16;
#X msg 28 442 npeak \$1;
#X text 36 22 FFT DATA PLOT;
#X obj 101 347 bng 22 250 50 0 empty empty Play -47 11 0 17 #dfdfdf #000000 #000000;
#X obj 118 421 output~;
#X text 316 337 template:;
#X text 230 423 The maximum number of peaks is '50'. Open [pd add-peaks] to see how the peaks are drawn as data structures., f 36;
#X text 189 12 This patch plots FFT "peaks" from a sampled sound analyzed via [sigmund~] and plotted as data structures., f 44;
#X obj 101 497 sigmund~ -npts 512 -hop 4096 -npeak 50 -maxfreq 8000 peaks;
#X obj 235 356 spigot;
#X obj 274 324 tgl 22 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X text 216 324 looping;
#X obj 101 381 tabplay~ sample1;
#X connect 3 0 11 2;
#X connect 6 0 11 3;
#X connect 9 0 11 0;
#X connect 10 0 9 0;
#X connect 14 0 11 1;
#X connect 15 0 11 1;
#X connect 16 0 11 1;
#X connect 21 0 22 0;
#X connect 22 0 29 0;
#X connect 24 0 33 0;
#X connect 29 0 2 0;
#X connect 30 0 24 0;
#X connect 31 0 30 1;
#X connect 33 0 25 0;
#X connect 33 0 25 1;
#X connect 33 0 29 0;
#X connect 33 1 30 0;
