#N canvas 447 38 549 567 12;
#X declare -stdpath ./;
#N canvas 136 407 1188 313 peaks-list 1;
#X coords 0 313 1 312 0 0 0;
#X restore 409 365 pd peaks-list;
#X text 345 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 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 136 53 860 453 sample 0;
#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 1;
#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~ \$0-sample;
#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 283 380 load 0;
#X obj 55 34 inlet;
#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 obj 55 257 soundfiler;
#X obj 55 195 list append \$0-sample;
#X msg 55 226 read -resize \$1 \$2;
#X connect 0 0 1 0;
#X connect 0 0 6 0;
#X connect 2 0 4 0;
#X connect 3 0 1 0;
#X connect 3 0 6 0;
#X connect 4 0 3 0;
#X connect 6 0 7 0;
#X connect 7 0 5 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~ \$0-sample;
#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 119 278 s \$0-sample;
#X msg 119 246 resize \$1;
#X obj 360 216 loadbang;
#X obj 456 321 declare -stdpath ./;
#X text 458 256 initialization;
#X msg 360 340 vis 1;
#X obj 360 309 delay 1000;
#X msg 378 251 \; npeaks 25;
#X obj 360 372 send pd-16.FFT-plot.pd;
#X obj 351 69 cnv 19 451 88 empty empty empty 20 12 0 12 #e0e0e0 #404040 0;
#N canvas 0 50 450 300 (subpatch) 0;
#X array \$0-sample 62079 float 2;
#X coords 0 1 62079 -1 453 90 1 0 0;
#X restore 350 68 graph;
#X connect 0 0 1 0;
#X connect 1 0 4 0;
#X connect 1 1 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 1;
#X connect 4 0 13 0;
#X connect 5 0 10 0;
#X connect 7 0 10 1;
#X connect 8 0 6 0;
#X connect 9 0 11 0;
#X connect 13 0 12 0;
#X connect 14 0 19 0;
#X connect 14 0 18 0;
#X connect 17 0 20 0;
#X connect 18 0 17 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 plotting FFT amplitude peaks \, where a polygon is drawn for all peaks., f 46;
#X restore 409 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 - npeaks - 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 336 337 template:;
#X text 245 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 245 356 spigot;
#X obj 284 324 tgl 22 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000 0 1;
#X text 226 324 looping;
#X obj 101 381 tabplay~ \$0-sample;
#X connect 3 0 10 2;
#X connect 5 0 10 3;
#X connect 8 0 10 0;
#X connect 9 0 8 0;
#X connect 13 0 10 1;
#X connect 14 0 10 1;
#X connect 15 0 10 1;
#X connect 20 0 21 0;
#X connect 21 0 28 0;
#X connect 23 0 32 0;
#X connect 28 0 2 0;
#X connect 29 0 23 0;
#X connect 30 0 29 1;
#X connect 32 0 24 0;
#X connect 32 0 28 0;
#X connect 32 1 29 0;
