aboutsummaryrefslogtreecommitdiff
path: root/desiredata/doc/3.audio.examples/F04.waveshaping.pulse.pd
blob: 5724aeba4648184a8ae4ba5fdd0533fd498ace63 (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
#N canvas 240 229 900 586 12;
#X obj 220 171 line~;
#X obj 220 147 pack 0 50;
#X floatatom 220 46 0 0 0 0 - - -;
#X obj 70 108 *~;
#X obj 220 72 / 10;
#X obj 220 96 moses 0;
#X msg 220 120 0;
#X text 215 28 bandwidth;
#X obj 78 141 *~;
#X obj 18 141 sig~ 1;
#X obj 39 194 /~;
#X obj 54 168 +~;
#X text 111 141 X^2;
#X text 84 171 1+X^2;
#X text 71 196 1/(1+X^2);
#X text 28 4 ANOTHER PULSE WIDTH MOD ALGORITHM;
#N canvas 0 0 450 300 graph1 0;
#X array F04-signal 882 float 0;
#X coords 0 1.02 882 -1.02 200 130 1;
#X restore 646 328 graph;
#N canvas 0 0 450 300 graph1 0;
#X array F04-spectrum 259 float 0;
#X coords 0 1.01 258 -0.008 256 200 1;
#X restore 587 38 graph;
#X text 646 461 ---- 0.02 seconds ----;
#X text 614 237 2;
#X text 645 237 4;
#X text 584 237 0;
#X text 622 252 -- partial number --;
#X text 677 237 6;
#X text 710 237 8;
#X text 738 237 10;
#X text 770 237 12;
#X text 802 237 14;
#X obj 40 277 output~;
#X obj 39 246 hip~;
#N canvas 122 211 558 609 fft 0;
#X obj 19 61 inlet~;
#X obj 224 210 inlet;
#X obj 29 92 rfft~;
#X obj 29 125 *~;
#X obj 60 125 *~;
#X obj 29 155 sqrt~;
#X obj 332 109 block~ 4096 1;
#X obj 29 181 biquad~ 0 0 0 0 1;
#X text 93 93 Fourier series;
#X text 98 146 magnitude;
#X text 96 131 calculate;
#X text 21 3 This subpatch computes the spectrum of the incoming signal
with a (rectangular windowed) FFT. FFTs aren't properly introduced
until much later.;
#X text 83 61 signal to analyze;
#X text 193 164 delay two samples;
#X text 191 182 for better graphing;
#X obj 264 434 samplerate~;
#X obj 251 255 metro 500;
#X obj 251 232 inlet;
#X text 301 232 toggle to graph repeatedly;
#X text 278 210 bang to graph once;
#X obj 29 205 /~ 4096;
#X obj 264 409 bang~;
#X obj 264 457 / 512;
#X obj 19 295 tabwrite~ F04-signal;
#X obj 250 291 tabwrite~ F04-spectrum;
#X obj 264 483 s freq/2;
#X msg 224 321 \; pd dsp 1;
#X connect 0 0 2 0;
#X connect 0 0 23 0;
#X connect 1 0 23 0;
#X connect 1 0 24 0;
#X connect 1 0 26 0;
#X connect 2 0 3 0;
#X connect 2 0 3 1;
#X connect 2 1 4 0;
#X connect 2 1 4 1;
#X connect 3 0 5 0;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 7 0 20 0;
#X connect 15 0 22 0;
#X connect 16 0 23 0;
#X connect 16 0 24 0;
#X connect 17 0 16 0;
#X connect 17 0 26 0;
#X connect 20 0 24 0;
#X connect 21 0 15 0;
#X connect 22 0 25 0;
#X restore 93 248 pd fft;
#X obj 153 227 bng 18 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 153 248 tgl 18 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X text 174 247 <-- repeatedly;
#X text 175 227 <-- graph once;
#X obj 69 81 osc~;
#X text 632 540 updated for Pd version 0.37;
#X text 23 515 NOTE: The PAF algorithm is protected by patents belonging
to IRCAM. Noncommercial use seems to be fine with them but contact
them first if you want to sell something using this.;
#X text 24 473 This is the form of pulse train used in the original
Phase Aligned Formant (PAF) algorithm.;
#X text 23 342 Here we use waveshaping to make another form of pulse
train. This one has a neat spectrum: the partials drop off exponentially
(with the "bandwidth" controlling the rate of dropoff.) In later patches
we'll use a wavetable to do the waveshaping but for simplicity \, it's
done algebraically here. The oscillator runs at half the fundamental
frequency. The symmetry of the waveshaping doubles the frequency of
the output.;
#X text 849 222 0;
#X text 846 35 1;
#X obj 69 56 r freq/2;
#X connect 0 0 3 1;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 3 0 8 0;
#X connect 3 0 8 1;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 5 1 1 0;
#X connect 6 0 1 0;
#X connect 8 0 11 1;
#X connect 9 0 10 0;
#X connect 9 0 11 0;
#X connect 10 0 29 0;
#X connect 10 0 30 0;
#X connect 11 0 10 1;
#X connect 29 0 28 0;
#X connect 29 0 28 1;
#X connect 31 0 30 1;
#X connect 32 0 30 2;
#X connect 35 0 3 0;
#X connect 42 0 35 0;