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

« back to all changes in this revision

Viewing changes to doc/3.audio.examples/E01.spectrum.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 190 29 773 821 12;
 
2
#N canvas 0 0 450 300 graph1 0;
 
3
#X array E01-signal 882 float 0;
 
4
#X coords 0 5 882 -5 200 130 1;
 
5
#X restore 531 41 graph;
 
6
#X obj 40 304 hip~ 5;
 
7
#N canvas 0 0 450 300 graph1 0;
 
8
#X array E01-spectrum 128 float 0;
 
9
#X coords 0 4300 127 -40 257 130 1;
 
10
#X restore 485 226 graph;
 
11
#X text 134 243 <-- click to graph;
 
12
#N canvas 45 83 558 569 fft 0;
 
13
#X obj 19 62 inlet~;
 
14
#X obj 85 214 inlet;
 
15
#X obj 19 92 rfft~;
 
16
#X obj 19 125 *~;
 
17
#X obj 50 125 *~;
 
18
#X obj 19 155 sqrt~;
 
19
#X obj 85 248 tabwrite~ E01-spectrum;
 
20
#X obj 332 109 block~ 4096 1;
 
21
#X obj 19 181 biquad~ 0 0 0 0 1;
 
22
#X text 83 93 Fourier series;
 
23
#X text 88 146 magnitude;
 
24
#X text 86 131 calculate;
 
25
#X text 21 3 This subpatch computes the spectrum of the incoming signal
 
26
with a (rectangular windowed) FFT. FFTs aren't properly introduced
 
27
until much later.;
 
28
#X text 83 62 signal to analyze;
 
29
#X text 182 166 delay two samples;
 
30
#X text 181 182 for better graphing;
 
31
#X obj 90 425 samplerate~;
 
32
#X obj 90 402 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
 
33
-1;
 
34
#X floatatom 90 472 5 0 0 0 - - -;
 
35
#X obj 90 448 / 256;
 
36
#X obj 90 378 loadbang;
 
37
#X floatatom 90 541 5 0 0 0 - - -;
 
38
#X obj 98 494 s fundamental;
 
39
#X obj 90 517 ftom;
 
40
#X text 146 540 <-just out of curiosity \, here's the pitch;
 
41
#X text 14 319 At load time \, calculate a good choice of fundamental
 
42
frequency for showing spectra: the 16th bin in a 4096-point spectrum
 
43
\, so SR*16/4096 or SR/256.;
 
44
#X text 135 216 "bang" into this inlet to graph it;
 
45
#X connect 0 0 2 0;
 
46
#X connect 1 0 6 0;
 
47
#X connect 2 0 3 0;
 
48
#X connect 2 0 3 1;
 
49
#X connect 2 1 4 0;
 
50
#X connect 2 1 4 1;
 
51
#X connect 3 0 5 0;
 
52
#X connect 4 0 5 0;
 
53
#X connect 5 0 8 0;
 
54
#X connect 8 0 6 0;
 
55
#X connect 16 0 19 0;
 
56
#X connect 17 0 16 0;
 
57
#X connect 18 0 22 0;
 
58
#X connect 18 0 23 0;
 
59
#X connect 19 0 18 0;
 
60
#X connect 20 0 17 0;
 
61
#X connect 23 0 21 0;
 
62
#X restore 51 279 pd fft;
 
63
#X text 531 173 ---- 0.02 seconds ----;
 
64
#X obj 111 244 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
 
65
-1;
 
66
#X obj 40 332 output~;
 
67
#X obj 111 279 tabwrite~ E01-signal;
 
68
#X text 523 800 updated for Pd version 0.37;
 
69
#X text 516 359 1;
 
70
#X text 550 359 2;
 
71
#X text 582 359 3;
 
72
#X text 614 359 4;
 
73
#X text 647 359 5;
 
74
#X text 677 359 6;
 
75
#X text 708 359 7;
 
76
#X text 484 359 0;
 
77
#X text 520 378 -- partial number --;
 
78
#X text 733 97 0;
 
79
#X obj 42 42 r fundamental;
 
80
#X obj 42 111 osc~;
 
81
#X obj 63 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
 
82
;
 
83
#X obj 41 161 *~;
 
84
#X obj 85 111 osc~;
 
85
#X obj 106 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
 
86
1;
 
87
#X obj 84 161 *~;
 
88
#X obj 128 111 osc~;
 
89
#X obj 149 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
 
90
1;
 
91
#X obj 127 161 *~;
 
92
#X obj 128 88 * 2;
 
93
#X obj 171 111 osc~;
 
94
#X obj 192 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
 
95
1;
 
96
#X obj 170 161 *~;
 
97
#X obj 214 111 osc~;
 
98
#X obj 235 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
 
99
1;
 
100
#X obj 213 161 *~;
 
101
#X obj 257 111 osc~;
 
102
#X obj 278 136 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
 
103
1;
 
104
#X obj 256 161 *~;
 
105
#X obj 42 88 * 0;
 
106
#X obj 85 88 * 1;
 
107
#X obj 171 88 * 3;
 
108
#X obj 214 88 * 4;
 
109
#X obj 257 88 * 5;
 
110
#X text 303 136 <-- On/Off;
 
111
#X text 337 152 for each;
 
112
#X text 339 168 partial;
 
113
#X text 595 11 WAVEFORM;
 
114
#X text 578 204 SPECTRUM;
 
115
#X text 25 415 The next series of patches demonstrates various kinds
 
116
of modulation: AM \, waveshaping \, and FM. We will need a tool for
 
117
graphing spectra which is introduced here. In this patch the signal
 
118
to be analyzed is a simple sum of up to six partials of a fundamental
 
119
frequency (which is 172 Hz \, close to F below middle C \, if your
 
120
sample rate happens to be 44100 Hz. The fundamental is chosen to agree
 
121
with the analysis patch ("pd FFT") and is computed within it).;
 
122
#X text 25 546 The partials are numbered 0 through 5 \, where 0 means
 
123
DC \, or zero frequency \, 1 is the fundamental \, and so on. The toggle
 
124
switches allow you to turn them on and off separately. You have to
 
125
press the "click to graph" button to update the two graphs.;
 
126
#X text 745 344 0;
 
127
#X text 743 223 1;
 
128
#X text 744 282 0.5;
 
129
#X text 26 631 The upper graph is just the (time domain) waveform \,
 
130
about four periods long. The lower graph is the magnitude spectrum.
 
131
Its peaks are the magnitudes of the partials. Note that a DC signal
 
132
of amplitude one is considered a partial of magnitude 1 \, but the
 
133
other partials \, which have peak amplitudes of 1 (and RMS 0.707) \,
 
134
have peak magnitudes of only 0.5 in the spectrum.;
 
135
#X obj 41 222 *~ 1;
 
136
#X text 733 37 5;
 
137
#X text 734 157 -5;
 
138
#X text 81 221 sum;
 
139
#X text 96 5 GRAPHING SPECTRA OF AUDIO SIGNALS;
 
140
#X text 24 742 Here we're introducing a new feature: multiple signals
 
141
connected to a signal inlet (as in the "*~ 1") are added. This is the
 
142
most convenient way to sum the six partials.;
 
143
#X connect 1 0 7 0;
 
144
#X connect 1 0 7 1;
 
145
#X connect 6 0 4 1;
 
146
#X connect 6 0 8 0;
 
147
#X connect 20 0 40 0;
 
148
#X connect 20 0 41 0;
 
149
#X connect 20 0 30 0;
 
150
#X connect 20 0 42 0;
 
151
#X connect 20 0 43 0;
 
152
#X connect 20 0 44 0;
 
153
#X connect 21 0 23 0;
 
154
#X connect 22 0 23 1;
 
155
#X connect 23 0 56 0;
 
156
#X connect 24 0 26 0;
 
157
#X connect 25 0 26 1;
 
158
#X connect 26 0 56 0;
 
159
#X connect 27 0 29 0;
 
160
#X connect 28 0 29 1;
 
161
#X connect 29 0 56 0;
 
162
#X connect 30 0 27 0;
 
163
#X connect 31 0 33 0;
 
164
#X connect 32 0 33 1;
 
165
#X connect 33 0 56 0;
 
166
#X connect 34 0 36 0;
 
167
#X connect 35 0 36 1;
 
168
#X connect 36 0 56 0;
 
169
#X connect 37 0 39 0;
 
170
#X connect 38 0 39 1;
 
171
#X connect 39 0 56 0;
 
172
#X connect 40 0 21 0;
 
173
#X connect 41 0 24 0;
 
174
#X connect 42 0 31 0;
 
175
#X connect 43 0 34 0;
 
176
#X connect 44 0 37 0;
 
177
#X connect 56 0 4 0;
 
178
#X connect 56 0 1 0;
 
179
#X connect 56 0 8 0;