aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/F03.pulse.spectrum.pd
blob: 1d04bf85047ac0825218a5543029e8e1bf745150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#N canvas 227 143 860 515 12;
#X obj 189 166 line~;
#X obj 42 187 cos~;
#X obj 189 142 pack 0 50;
#X floatatom 189 41 0 0 100 0 - - -;
#X obj 43 114 -~ 0.5;
#X obj 43 140 *~;
#X obj 189 67 / 10;
#X obj 189 91 moses 0;
#X msg 189 115 0;
#X obj 42 163 clip~ -0.5 0.5;
#X text 184 23 bandwidth;
#X obj 189 191 +~ 1;
#X obj 42 211 +~ 1;
#X text 63 1 PULSE SPECTRUM MEASUREMENT;
#X text 14 357 Here is a measured amplitude spectrum for the pulse
train. Nutice that \, other than a smallish spillover \, the energy
sits in one "lobe" whose changing width justifies our calling the squeeze
factor the "bandwidth.";
#X text 16 428 The spectrum is in units of amplitude. THe sidelobes
\, although they look small \, are actually only about 34 dB down.
You can design more complicated pulse trains \, little Blackman window
functions \, which control the sidelobes much better.;
#X obj 42 293 output~;
#X obj 41 262 hip~;
#N canvas 122 211 558 609 fft 0;
#X obj 19 61 inlet~;
#X obj 208 212 inlet;
#X obj 29 92 rfft~;
#X obj 29 125 *~;
#X obj 60 125 *~;
#X obj 29 155 sqrt~;
#X obj 332 109 block~ 4096 1;
#X obj 29 181 biquad~ 0 0 0 0 1;
#X text 93 93 Fourier series;
#X text 98 146 magnitude;
#X text 96 131 calculate;
#X text 21 3 This subpatch computes the spectrum of the incoming signal
with a (rectangular windowed) FFT. FFTs aren't properly introduced
until much later.;
#X text 83 61 signal to analyze;
#X text 193 164 delay two samples;
#X text 191 182 for better graphing;
#X obj 264 434 samplerate~;
#X obj 264 457 / 256;
#X obj 238 261 metro 500;
#X obj 238 238 inlet;
#X text 291 236 toggle to graph repeatedly;
#X text 262 212 bang to graph once;
#X obj 29 205 /~ 4096;
#X obj 19 295 tabwrite~ F03-signal;
#X obj 235 299 tabwrite~ F03-spectrum;
#X obj 264 409 bang~;
#X msg 209 322 \; pd dsp 1;
#X obj 264 482 s freq;
#X connect 0 0 2 0;
#X connect 0 0 22 0;
#X connect 1 0 22 0;
#X connect 1 0 23 0;
#X connect 1 0 25 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 26 0;
#X connect 17 0 22 0;
#X connect 17 0 23 0;
#X connect 18 0 17 0;
#X connect 18 0 25 0;
#X connect 21 0 23 0;
#X connect 24 0 15 0;
#X restore 95 264 pd fft;
#X obj 155 243 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 155 264 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X text 176 263 <-- repeatedly;
#X text 177 243 <-- graph once;
#X obj 42 235 *~ 0.5;
#X obj 43 90 phasor~;
#N canvas 0 0 450 300 graph1 0;
#X array F03-signal 882 float 0;
#X coords 0 1.02 882 -1.02 200 130 1;
#X restore 640 321 graph;
#N canvas 0 0 450 300 graph1 0;
#X array F03-spectrum 259 float 0;
#X coords 0 0.51 258 -0.008 256 130 1;
#X restore 579 99 graph;
#X text 640 454 ---- 0.02 seconds ----;
#X text 608 230 2;
#X text 639 230 4;
#X text 578 230 0;
#X text 616 245 -- partial number --;
#X text 671 230 6;
#X text 704 230 8;
#X text 732 230 10;
#X text 764 230 12;
#X text 796 230 14;
#X text 605 488 updated for Pd version 0.37;
#X obj 43 63 r freq;
#X connect 0 0 11 0;
#X connect 1 0 12 0;
#X connect 2 0 0 0;
#X connect 3 0 6 0;
#X connect 4 0 5 0;
#X connect 5 0 9 0;
#X connect 6 0 7 0;
#X connect 7 0 8 0;
#X connect 7 1 2 0;
#X connect 8 0 2 0;
#X connect 9 0 1 0;
#X connect 11 0 5 1;
#X connect 12 0 23 0;
#X connect 17 0 16 0;
#X connect 17 0 16 1;
#X connect 19 0 18 1;
#X connect 20 0 18 2;
#X connect 23 0 17 0;
#X connect 23 0 18 0;
#X connect 24 0 4 0;
#X connect 38 0 24 0;