aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/F07.packet.spectrum.pd
blob: bef1483b6aecd4e2b698680c88ce426a4bede1cf (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#N canvas 83 221 774 628 12;
#X obj 302 351 line~;
#X obj 34 444 cos~;
#X floatatom 71 560 0 0 0;
#N canvas 176 241 532 273 output 0;
#X obj 338 160 t b;
#X obj 338 110 f;
#X obj 338 60 inlet;
#X text 344 29 mute;
#X obj 338 185 f;
#X msg 425 178 0;
#X msg 338 85 bang;
#X obj 338 135 moses 1;
#X obj 398 111 moses 1;
#X obj 83 148 dbtorms;
#X obj 398 86 r master-lvl;
#X obj 83 42 r master-lvl;
#X obj 338 210 s master-lvl;
#X obj 17 148 inlet~;
#X obj 199 41 inlet;
#X text 199 18 level;
#X obj 199 100 s master-lvl;
#X msg 96 65 set \$1;
#X obj 96 89 outlet;
#X msg 214 64 \; pd dsp 1;
#X obj 83 194 line~;
#X obj 22 212 *~;
#X obj 22 241 dac~;
#X obj 83 171 pack 0 50;
#X text 15 125 audio;
#X text 93 110 show level;
#X obj 17 177 hip~ 1;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 12 0;
#X connect 5 0 12 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 5 0;
#X connect 8 1 4 1;
#X connect 9 0 23 0;
#X connect 10 0 1 1;
#X connect 10 0 8 0;
#X connect 11 0 9 0;
#X connect 11 0 17 0;
#X connect 13 0 26 0;
#X connect 14 0 16 0;
#X connect 14 0 19 0;
#X connect 17 0 18 0;
#X connect 20 0 21 1;
#X connect 21 0 22 0;
#X connect 21 0 22 1;
#X connect 23 0 20 0;
#X connect 26 0 21 0;
#X restore 35 587 pd output;
#X msg 111 560 MUTE;
#X obj 302 327 pack 0 50;
#X floatatom 302 255 0 0 0;
#X obj 34 356 -~ 0.5;
#X obj 34 395 *~;
#X obj 302 279 / 10;
#X obj 34 420 clip~ -0.5 0.5;
#X text 302 233 bandwidth;
#X obj 302 375 +~ 1;
#X obj 35 467 +~ 1;
#X obj 184 440 cos~;
#X obj 35 496 *~;
#X floatatom 206 269 4 0 0;
#X obj 206 293 / 10;
#X obj 184 414 *~;
#X text 204 224 center;
#X text 204 243 freq.;
#X obj 302 303 max 0;
#X obj 206 365 line~;
#X obj 206 341 pack 0 50;
#X obj 206 317 max 0;
#X floatatom 34 308 4 0 0;
#X obj 34 332 phasor~ 100;
#X text 156 559 <-- output;
#X text 30 283 freq.;
#X text 30 264 fundamental;
#X graph graph1 0 0 128 500 440 492 696 362;
#X array spectrum 128 float 0;
#X pop;
#X msg 108 498 bang;
#N canvas 204 17 358 238 fft 0;
#X obj 46 48 inlet~;
#X obj 159 181 tabwrite~ spectrum;
#X obj 159 145 inlet;
#X obj 46 78 rfft~;
#X obj 46 111 *~;
#X obj 77 111 *~;
#X obj 46 141 sqrt~;
#X obj 191 45 block~ 1024 1;
#X connect 0 0 3 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 3 0 4 1;
#X connect 3 1 5 0;
#X connect 3 1 5 1;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 1 0;
#X restore 59 524 pd fft;
#X text 439 502 0;
#X text 687 499 5512;
#X text 149 498 <-- graph;
#X text 31 2 WINDOWED PACKET SPECTRUM;
#X text 19 34 Here's the spectrum you get. Note that even if you put
the center frequency right on a partial \, there is significant energy
in neighboring partials (try fundamental 440 \, "center freq" 30 \,
bandwidth 0.);
#X text 18 104 The center frequency is in units of ten per partial
\, or in other words a value of "30" means "centered on the third partial".
;
#X text 505 596 updated for Pd version 0.34;
#X text 22 155 This technique only works if you're doing Hanning-window
shaped PWM--you can't combine this naturally with FM or with the waveshaping
technique we'll see later.;
#X connect 0 0 12 0;
#X connect 1 0 13 0;
#X connect 2 0 3 1;
#X connect 3 0 2 0;
#X connect 4 0 3 2;
#X connect 5 0 0 0;
#X connect 6 0 9 0;
#X connect 7 0 8 0;
#X connect 7 0 18 0;
#X connect 8 0 10 0;
#X connect 9 0 21 0;
#X connect 10 0 1 0;
#X connect 12 0 8 1;
#X connect 13 0 15 0;
#X connect 14 0 15 1;
#X connect 15 0 3 0;
#X connect 15 0 32 0;
#X connect 16 0 17 0;
#X connect 17 0 24 0;
#X connect 18 0 14 0;
#X connect 21 0 5 0;
#X connect 22 0 18 1;
#X connect 23 0 22 0;
#X connect 24 0 23 0;
#X connect 25 0 26 0;
#X connect 26 0 7 0;
#X connect 31 0 32 1;