From 77e10562d6910e29de6f71fc242edf1562c5e3cb Mon Sep 17 00:00:00 2001 From: kronikle Date: Sat, 27 Mar 2021 01:44:20 +0100 Subject: [PATCH] add sources/abstractions --- sources/abstractions/k_spectrum.pd | 85 ++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/abstractions/k_spectrum.pd diff --git a/sources/abstractions/k_spectrum.pd b/sources/abstractions/k_spectrum.pd new file mode 100644 index 0000000..b9a0a5e --- /dev/null +++ b/sources/abstractions/k_spectrum.pd @@ -0,0 +1,85 @@ +#N canvas 1114 169 788 600 12; +#N canvas 335 184 569 608 fft 0; +#X obj 43 105 inlet~; +#X obj 243 263 inlet; +#X obj 63 136 rfft~; +#X obj 63 169 *~; +#X obj 95 169 *~; +#X obj 63 199 sqrt~; +#X obj 366 153 block~ 4096 1; +#X obj 63 225 biquad~ 0 0 0 0 1; +#X text 127 137 Fourier series; +#X text 132 190 magnitude; +#X text 130 175 calculate; +#X text 60 26 This subpatch computes the spectrum of the incoming signal +with a (rectangular windowed) FFT. FFTs aren't properly introduced +until much later.; +#X text 105 104 signal to analyze; +#X text 194 216 delay two samples; +#X text 192 234 for better graphing; +#X obj 298 501 samplerate~; +#X obj 298 524 / 256; +#X obj 273 332 metro 500; +#X obj 272 292 inlet; +#X text 325 290 toggle to graph repeatedly; +#X text 297 263 bang to graph once; +#X obj 63 249 /~ 4096; +#X obj 298 476 bang~; +#X msg 243 389 \; pd dsp 1; +#X obj 298 549 s freq; +#X obj 43 392 tabwrite~ \$0-signal; +#X obj 272 366 tabwrite~ \$0-spectrum; +#X connect 0 0 2 0; +#X connect 0 0 25 0; +#X connect 1 0 23 0; +#X connect 1 0 25 0; +#X connect 1 0 26 0; +#X connect 2 0 3 0; +#X connect 2 0 3 1; +#X connect 2 1 4 0; +#X connect 2 1 4 1; +#X connect 3 0 5 0; +#X connect 4 0 5 0; +#X connect 5 0 7 0; +#X connect 7 0 21 0; +#X connect 15 0 16 0; +#X connect 16 0 24 0; +#X connect 17 0 25 0; +#X connect 17 0 26 0; +#X connect 18 0 17 0; +#X connect 18 0 23 0; +#X connect 21 0 26 0; +#X connect 22 0 15 0; +#X restore 404 361 pd fft; +#X obj 190 68 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 190 102 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 212 68 <= graph once; +#X text 211 101 <= repeatedly; +#N canvas 0 0 450 300 (subpatch) 0; +#X array \$0-signal 882 float 0; +#X coords 0 1.02 882 -1.02 200 130 1 0 0; +#X restore 80 380 graph; +#N canvas 0 0 450 300 (subpatch) 0; +#X array \$0-spectrum 259 float 0; +#X coords 0 0.51 258 -0.008 256 130 1; +#X restore 48 167 graph; +#X text 80 513 ---- 0.02 seconds ----; +#X text 77 298 2; +#X text 108 298 4; +#X text 47 298 0; +#X text 119 323 -- partial number --; +#X text 140 298 6; +#X text 173 298 8; +#X text 201 298 10; +#X text 233 298 12; +#X text 265 298 14; +#X obj 404 245 inlet~; +#X text 58 492 -1; +#X text 65 376 1; +#X text 65 435 0; +#X connect 1 0 0 1; +#X connect 2 0 0 2; +#X connect 17 0 0 0; +#X coords 0 -1 1 1 300 500 1 30 50;