~ubuntu-branches/ubuntu/precise/puredata/precise

« back to all changes in this revision

Viewing changes to doc/3.audio.examples/I02.Hann.window.pd

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2009-12-22 21:29:31 UTC
  • mfrom: (1.2.6 upstream) (4.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091222212931-nhwkzapjwsmjao1l
Tags: 0.42.5-3
* debian/control:
  - add community site to homepage field
  - improve long description
  - remove Replaces and Conflicts fields
  - add Suggests on pd-csound, pd-pdp, pd-zexy, pd-aubio
* debian/rules: add per-arch configuration flags
* debian/patches/02_kfreebsd.diff:
  - also define pd_tilde_dllextent on FreeBSD
  - fix typo (really closing #414414 this time)
  - also add hurd glue
* debian/patches/04_hurd.diff:
  - add hurd glue and s_midi_dummy.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#N canvas 281 223 567 589 12;
 
2
#N canvas 228 148 651 544 fft-analysis 0;
 
3
#X obj 15 164 *~;
 
4
#X obj 14 99 inlet~;
 
5
#X obj 15 218 rfft~;
 
6
#X obj 36 140 tabreceive~ \$0-hann;
 
7
#X obj 14 306 *~;
 
8
#X obj 56 306 *~;
 
9
#X obj 15 356 sqrt~;
 
10
#X obj 14 498 tabwrite~ \$0-magnitude;
 
11
#X obj 23 386 loadbang;
 
12
#X obj 23 470 metro 250;
 
13
#X obj 23 449 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
 
14
;
 
15
#X msg 31 411 \; pd dsp 1;
 
16
#X obj 15 8 block~ 512;
 
17
#X text 225 131 tabreceive~ outputs array contents \,;
 
18
#X text 225 149 constantly \, every block. Here it's;
 
19
#X text 223 169 used to get the Hann window to;
 
20
#X text 225 187 multiply by the input.;
 
21
#X text 120 7 block~ object does no computation but declares this;
 
22
#X text 120 24 window to be operating at a different block size from
 
23
;
 
24
#X text 122 58 Fourier transform.;
 
25
#X text 121 40 the parent window. This determines the size of the;
 
26
#X text 76 99 The inlet~ automatically re-blocks to the new block size.
 
27
;
 
28
#X obj 15 332 +~;
 
29
#X text 94 308 Take the magnitude by squaring real and imaginary part
 
30
\, adding and taking square root.;
 
31
#X text 110 424 periodically graph the output. It appears every 512
 
32
samples (about 12 milliseconds) but we only update the graph 4 times
 
33
per second. The graph is back on the main (parent) window.;
 
34
#X text 82 215 forward real FFT. Like "fft~" \, but only one inlet
 
35
(for the real part) and only the first half of the output signals are
 
36
used. (The others are determined by symmetry: they're complex conjugates
 
37
of the first half \, in reverse order.) This takes 1/2 the CPU time
 
38
of "fft".;
 
39
#X connect 0 0 2 0;
 
40
#X connect 1 0 0 0;
 
41
#X connect 2 0 4 0;
 
42
#X connect 2 0 4 1;
 
43
#X connect 2 1 5 0;
 
44
#X connect 2 1 5 1;
 
45
#X connect 3 0 0 1;
 
46
#X connect 4 0 22 0;
 
47
#X connect 5 0 22 1;
 
48
#X connect 6 0 7 0;
 
49
#X connect 8 0 10 0;
 
50
#X connect 8 0 11 0;
 
51
#X connect 9 0 7 0;
 
52
#X connect 10 0 9 0;
 
53
#X connect 22 0 6 0;
 
54
#X restore 26 289 pd fft-analysis;
 
55
#N canvas 0 0 450 300 graph1 0;
 
56
#X array \$0-magnitude 256 float 0;
 
57
#X coords 0 256 255 0 256 100 1;
 
58
#X restore 287 208 graph;
 
59
#X text 110 6 WINDOWING AND BLOCKING FOURIER TRANSFORMS;
 
60
#X obj 25 264 osc~;
 
61
#X floatatom 25 218 5 0 0 0 - - -;
 
62
#X obj 25 240 * 10;
 
63
#X text 305 559 updated for Pd version 0.39;
 
64
#X text 349 183 magnitude;
 
65
#X text 284 311 0;
 
66
#X text 522 311 255;
 
67
#X text 273 297 0;
 
68
#X text 255 253 128;
 
69
#X text 254 203 256;
 
70
#N canvas 0 0 450 300 graph1 0;
 
71
#X array \$0-hann 512 float 1;
 
72
#A 0 0 3.76403e-05 0.000150591 0.000338793 0.000602275 0.000940949
 
73
0.00135478 0.00184369 0.00240764 0.00304651 0.00376022 0.00454867 0.00541174
 
74
0.0063493 0.00736117 0.00844723 0.00960734 0.0108413 0.0121489 0.01353
 
75
0.0149843 0.0165117 0.0181119 0.0197847 0.0215298 0.0233469 0.0252359
 
76
0.0271963 0.0292279 0.0313304 0.0335035 0.0357469 0.0380601 0.040443
 
77
0.042895 0.0454159 0.0480052 0.0506626 0.0533877 0.05618 0.0590392
 
78
0.0619648 0.0649563 0.0680134 0.0711355 0.0743222 0.077573 0.0808874
 
79
0.0842649 0.0877051 0.0912073 0.0947711 0.0983959 0.102081 0.105826
 
80
0.109631 0.113494 0.117416 0.121395 0.125431 0.129524 0.133672 0.137876
 
81
0.142134 0.146446 0.150811 0.155229 0.159699 0.16422 0.168792 0.173413
 
82
0.178084 0.182803 0.18757 0.192384 0.197244 0.20215 0.2071 0.212095
 
83
0.217133 0.222214 0.227337 0.2325 0.237704 0.242948 0.24823 0.25355
 
84
0.258907 0.264301 0.26973 0.275194 0.280691 0.286222 0.291785 0.297379
 
85
0.303003 0.308658 0.314341 0.320052 0.32579 0.331555 0.337344 0.343159
 
86
0.348997 0.354857 0.36074 0.366643 0.372567 0.37851 0.384471 0.390449
 
87
0.396444 0.402454 0.40848 0.414519 0.420571 0.426634 0.432709 0.438794
 
88
0.444889 0.450991 0.457101 0.463218 0.469339 0.475466 0.481596 0.487729
 
89
0.493864 0.5 0.506136 0.512271 0.518404 0.524534 0.53066 0.536782 0.542899
 
90
0.549009 0.555111 0.561205 0.56729 0.573365 0.579429 0.585481 0.59152
 
91
0.597545 0.603556 0.609551 0.615529 0.62149 0.627433 0.633357 0.63926
 
92
0.645143 0.651003 0.656841 0.662656 0.668445 0.67421 0.679948 0.685659
 
93
0.691342 0.696997 0.702621 0.708215 0.713778 0.719309 0.724806 0.73027
 
94
0.735699 0.741092 0.74645 0.75177 0.757052 0.762295 0.767499 0.772663
 
95
0.777786 0.782867 0.787905 0.7929 0.79785 0.802756 0.807616 0.81243
 
96
0.817197 0.821916 0.826587 0.831209 0.83578 0.840301 0.844771 0.849189
 
97
0.853554 0.857866 0.862124 0.866328 0.870476 0.874569 0.878605 0.882584
 
98
0.886506 0.890369 0.894174 0.897919 0.901605 0.905229 0.908793 0.912295
 
99
0.915736 0.919113 0.922428 0.925678 0.928865 0.931987 0.935044 0.938036
 
100
0.940961 0.94382 0.946613 0.949338 0.951995 0.954585 0.957106 0.959558
 
101
0.96194 0.964254 0.966497 0.96867 0.970773 0.972804 0.974765 0.976654
 
102
0.978471 0.980216 0.981889 0.983489 0.985016 0.98647 0.987852 0.989159
 
103
0.990393 0.991553 0.992639 0.993651 0.994589 0.995452 0.99624 0.996954
 
104
0.997593 0.998156 0.998645 0.999059 0.999398 0.999661 0.999849 0.999962
 
105
1 0.999962 0.999849 0.999661 0.999398 0.999059 0.998645 0.998156 0.997592
 
106
0.996953 0.996239 0.995451 0.994588 0.99365 0.992638 0.991552 0.990392
 
107
0.989158 0.987851 0.986469 0.985015 0.983488 0.981887 0.980215 0.978469
 
108
0.976652 0.974763 0.972803 0.970771 0.968669 0.966495 0.964252 0.961939
 
109
0.959556 0.957104 0.954583 0.951993 0.949336 0.946611 0.943819 0.940959
 
110
0.938034 0.935042 0.931985 0.928863 0.925676 0.922425 0.919111 0.915733
 
111
0.912293 0.908791 0.905227 0.901602 0.897917 0.894171 0.890367 0.886503
 
112
0.882582 0.878602 0.874566 0.870473 0.866325 0.862121 0.857863 0.853551
 
113
0.849186 0.844768 0.840298 0.835777 0.831205 0.826584 0.821913 0.817194
 
114
0.812427 0.807613 0.802753 0.797847 0.792896 0.787901 0.782863 0.777782
 
115
0.77266 0.767496 0.762292 0.757048 0.751766 0.746446 0.741089 0.735695
 
116
0.730266 0.724802 0.719305 0.713774 0.708211 0.702617 0.696993 0.691338
 
117
0.685655 0.679944 0.674206 0.668441 0.662652 0.656837 0.650999 0.645139
 
118
0.639256 0.633353 0.627429 0.621486 0.615525 0.609547 0.603552 0.597541
 
119
0.591516 0.585477 0.579425 0.573361 0.567286 0.561201 0.555107 0.549004
 
120
0.542895 0.536778 0.530656 0.52453 0.518399 0.512266 0.506132 0.499996
 
121
0.49386 0.487725 0.481592 0.475462 0.469335 0.463213 0.457097 0.450987
 
122
0.444885 0.43879 0.432705 0.42663 0.420566 0.414515 0.408476 0.40245
 
123
0.39644 0.390445 0.384466 0.378505 0.372563 0.366639 0.360736 0.354853
 
124
0.348993 0.343155 0.33734 0.331551 0.325786 0.320048 0.314337 0.308654
 
125
0.303 0.297375 0.291781 0.286218 0.280687 0.27519 0.269726 0.264297
 
126
0.258904 0.253547 0.248226 0.242944 0.237701 0.232497 0.227333 0.222211
 
127
0.21713 0.212092 0.207097 0.202146 0.19724 0.19238 0.187566 0.182799
 
128
0.17808 0.17341 0.168788 0.164217 0.159696 0.155226 0.150808 0.146443
 
129
0.142131 0.137873 0.133669 0.129521 0.125428 0.121392 0.117413 0.113491
 
130
0.109628 0.105823 0.102078 0.0983929 0.0947681 0.0912044 0.0877022
 
131
0.0842621 0.0808846 0.0775702 0.0743194 0.0711327 0.0680107 0.0649537
 
132
0.0619622 0.0590366 0.0561775 0.0533853 0.0506602 0.0480029 0.0454136
 
133
0.0428928 0.0404408 0.038058 0.0357448 0.0335015 0.0313284 0.029226
 
134
0.0271944 0.025234 0.0233452 0.0215281 0.019783 0.0181104 0.0165102
 
135
0.0149829 0.0135286 0.0121476 0.01084 0.00960615 0.0084461 0.0073601
 
136
0.00634828 0.00541082 0.00454783 0.00375944 0.00304583 0.00240701 0.00184315
 
137
0.00135431 0.000940561 0.000601947 0.000338584 0.000150442 3.75807e-05
 
138
;
 
139
#X coords 0 1 511 0 200 120 1;
 
140
#X restore 278 401 graph;
 
141
#X msg 156 415 0;
 
142
#X obj 50 464 osc~;
 
143
#X obj 50 416 samplerate~;
 
144
#X obj 50 487 *~ -0.5;
 
145
#X obj 50 510 +~ 0.5;
 
146
#X obj 42 535 tabwrite~ \$0-hann;
 
147
#X text 264 393 1;
 
148
#X text 257 511 0;
 
149
#X text 273 524 0;
 
150
#X obj 50 440 / 512;
 
151
#X obj 42 393 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
 
152
-1;
 
153
#X text 321 373 Hann window;
 
154
#X text 98 462 period 512;
 
155
#X text 40 368 recalculate Hann;
 
156
#X text 75 383 window table;
 
157
#X text 100 233 tens of Hz.;
 
158
#X text 80 215 <- frequency \,;
 
159
#X text 98 270 click here and;
 
160
#X text 170 286 <- see;
 
161
#X text 21 32 In this example we use a sub-patch ("pd fft-analysis")
 
162
to re-block the Fourier transform to 512 points. The signal is multiplied
 
163
by the Hann window function (which is just a raised cosine.) The magnitude
 
164
\, which is computed in the sub-patch \, is graphed below in this window.
 
165
The point at 255 corresponds to just below the Nyquist frequency. Phase
 
166
isn't shown \, and unlike the previous patch we don't control the initial
 
167
phase of the oscillator. (For fun \, try drawing other window functions
 
168
with the mouse...);
 
169
#X text 459 527 511;
 
170
#X connect 3 0 0 0;
 
171
#X connect 4 0 5 0;
 
172
#X connect 5 0 3 0;
 
173
#X connect 14 0 15 1;
 
174
#X connect 15 0 17 0;
 
175
#X connect 16 0 23 0;
 
176
#X connect 17 0 18 0;
 
177
#X connect 18 0 19 0;
 
178
#X connect 23 0 15 0;
 
179
#X connect 24 0 16 0;
 
180
#X connect 24 0 14 0;
 
181
#X connect 24 0 19 0;