aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/K01.pulse.width.mod.pd
blob: 214d250af9dbc321f159ed4fc750896cc76d41b3 (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
#N canvas 27 355 931 532 12;
#X floatatom 86 104 0 0 0;
#X graph graph1 0 -1.02 882 1.02 669 456 869 326;
#X array difference-output 882 float 0;
#X pop;
#X floatatom 123 324 0 0 0;
#N canvas 159 26 495 266 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 425 153 t b f;
#X obj 397 117 moses 1;
#X obj 83 148 dbtorms;
#X obj 397 92 r master-lvl;
#X obj 83 42 r master-lvl;
#X obj 338 210 s master-lvl;
#X obj 22 181 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 20 158 audio;
#X text 93 110 show level;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 13 0;
#X connect 5 0 13 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 8 0;
#X connect 8 0 5 0;
#X connect 9 1 4 1;
#X connect 10 0 24 0;
#X connect 11 0 1 1;
#X connect 11 0 9 0;
#X connect 12 0 10 0;
#X connect 12 0 18 0;
#X connect 14 0 22 0;
#X connect 15 0 17 0;
#X connect 15 0 20 0;
#X connect 18 0 19 0;
#X connect 21 0 22 1;
#X connect 22 0 23 0;
#X connect 22 0 23 1;
#X connect 24 0 21 0;
#X restore 86 351 pd output;
#X msg 162 324 MUTE;
#X obj 86 137 phasor~ 0;
#X text 83 86 frequency;
#X graph graph1 0 -1.02 882 1.02 668 179 868 49;
#X array phasor1-output 882 float 0;
#X pop;
#X msg 191 77 bang;
#X text 231 76 <-- click to graph;
#X text 57 9 CLASSICAL PULSE WIDTH MODULATION;
#X obj 102 196 phasor~ 0;
#X obj 102 172 + 0.2;
#X obj 86 246 -~;
#X graph graph1 0 -1.02 882 1.02 668 316 868 186;
#X array phasor2-output 882 float 0;
#X pop;
#X obj 191 164 tabwrite~ phasor1-output;
#X obj 191 222 tabwrite~ phasor2-output;
#X obj 191 276 tabwrite~ difference-output;
#X text 12 386 This patch demonstrates pulse width modulation \, which
is accomplished simply by subtracting two sawtooth waves at a varying
phase difference. Here their frequencies are set to differ by 1/5 Hz.
so that the relative phase wanders continuously.;
#X text 669 459 ---- 0.02 seconds ----;
#X text 665 498 updated for Pd version 0.34;
#X text 203 325 <-- output;
#X connect 0 0 5 0;
#X connect 0 0 12 0;
#X connect 2 0 3 1;
#X connect 3 0 2 0;
#X connect 4 0 3 2;
#X connect 5 0 13 0;
#X connect 5 0 15 0;
#X connect 8 0 15 0;
#X connect 8 0 16 0;
#X connect 8 0 17 0;
#X connect 11 0 13 1;
#X connect 11 0 16 0;
#X connect 12 0 11 0;
#X connect 13 0 17 0;
#X connect 13 0 3 0;