aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/F08.two.cosines.pd
blob: ae4788f6ceee4409f48170f28040c9a36589a520 (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
#N canvas 534 115 698 613 12;
#X obj 157 408 cos~;
#X floatatom 204 198 4 0 100 0 - - -;
#X obj 204 222 / 10;
#X text 461 275 --- 0.02 seconds ---;
#X obj 157 378 *~;
#X obj 204 294 line~;
#X obj 204 246 max 0;
#N canvas 0 0 450 300 graph3 0;
#X array F08-carrier 882 float 0;
#X coords 0 2 881 -2 200 140 1;
#X restore 447 123 graph;
#X floatatom 57 295 4 0 0 0 - - -;
#X text 53 251 fundamental;
#X text 53 270 frequency;
#X obj 199 408 cos~;
#X obj 240 321 wrap~;
#X obj 204 348 -~;
#X obj 199 378 +~;
#X obj 204 445 -~;
#X obj 219 475 *~;
#X obj 197 500 +~;
#X obj 204 270 pack 0 50;
#X text 254 408 synthesize the two partials;
#X text 447 590 updated for Pd version 0.37;
#X obj 198 526 hip~;
#X obj 199 552 output~;
#X text 26 29 The other \, spiffier way is to make a sum of cosines
to interpolate between adjacent harmonics. Suppose for example we want
a center frequency of 5.3 (in units of the fundamental.) We just take
partial 5 with amplitude 0.7 and partial 6 with amplitude 0.3:;
#X obj 286 552 tabwrite~ F08-carrier;
#X text 316 528 <-graph;
#X obj 284 527 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 57 319 phasor~ 100;
#X text 83 149 center frequency (in;
#X text 82 169 tenths of fundamental);
#X text 125 3 MOVABLE CENTER FREQUENCY BY ADDING TWO COSINES;
#X text 295 320 the fractional part "q";
#X text 253 347 subtract to get the integer part "k";
#X text 249 380 multiply phase by k and k+1;
#X text 252 444 c2 - c1;
#X text 267 473 q * (c2 - c1);
#X text 236 500 q * c2 + (1-q) * c1;
#X connect 0 0 15 1;
#X connect 0 0 17 0;
#X connect 1 0 2 0;
#X connect 2 0 6 0;
#X connect 4 0 0 0;
#X connect 4 0 14 0;
#X connect 5 0 13 0;
#X connect 5 0 12 0;
#X connect 6 0 18 0;
#X connect 8 0 27 0;
#X connect 11 0 15 0;
#X connect 12 0 13 1;
#X connect 12 0 16 1;
#X connect 13 0 4 1;
#X connect 14 0 11 0;
#X connect 15 0 16 0;
#X connect 16 0 17 1;
#X connect 17 0 21 0;
#X connect 17 0 24 0;
#X connect 18 0 5 0;
#X connect 21 0 22 0;
#X connect 21 0 22 1;
#X connect 26 0 24 0;
#X connect 27 0 4 0;
#X connect 27 0 14 1;