aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/30.sampler.scratch.pd
blob: d4602050f5d06c0b3657e79944ac7423c8e22491 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#N canvas 33 19 1046 749 12;
#X msg 354 13 \; pd dsp 1;
#X msg 437 13 \; pd dsp 0;
#X text 379 51 ON;
#X text 457 51 OFF;
#X graph graph1 0 -1.02 44100 1.02 757 142 957 12;
#X array sample-table 44103 float 0;
#X pop;
#X floatatom 71 466 0 0 0;
#N canvas 159 26 495 266 output 0;
#X obj 406 192 t b;
#X obj 406 132 f;
#X obj 406 72 inlet;
#X text 413 35 mute;
#X obj 406 222 f;
#X msg 510 214 0;
#X msg 406 102 bang;
#X obj 406 162 moses 1;
#X obj 510 184 t b f;
#X obj 476 140 moses 1;
#X obj 100 178 dbtorms;
#X obj 476 110 r master-lvl;
#X obj 100 50 r master-lvl;
#X obj 406 252 s master-lvl;
#X obj 26 217 inlet~;
#X obj 239 49 inlet;
#X text 239 22 level;
#X obj 239 120 s master-lvl;
#X msg 115 78 set \$1;
#X obj 115 107 outlet;
#X msg 257 77 \; pd dsp 1;
#X obj 100 233 line~;
#X obj 26 254 *~;
#X obj 26 289 dac~;
#X obj 100 205 pack 0 50;
#X text 24 190 audio;
#X text 112 132 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 36 499 pd output;
#X msg 106 466 MUTE;
#X text 145 465 <-- output amplitude;
#X obj 36 427 hip~ 5;
#X obj 55 368 tabread4~ sample-table;
#X floatatom 55 60 0 0 0;
#X text 102 59 <-- frequency (Hz.);
#X floatatom 109 152 0 0 0;
#X obj 109 181 * 441;
#X obj 55 152 *~ 0;
#X obj 55 181 +~ 1;
#X obj 55 89 phasor~ 0;
#X msg 172 246 bang;
#X text 156 151 <-- chunk size (100ths of a second);
#X obj 598 451 adc~ 1;
#X obj 598 480 hip~ 5;
#X obj 598 540 tabwrite~ sample-table;
#X msg 616 508 bang;
#X text 654 507 <-- click here to record your own sample;
#X text 64 17 ENVELOPING YOUR LOOPING SAMPLER;
#X graph graph2 0 0 44100 44100 760 345 960 215;
#X array table-index 44100 float 0;
#X pop;
#X obj 172 308 tabwrite~ table-index;
#X obj 36 398 *~;
#N canvas 160 476 591 415 envelope 0;
#X obj 97 82 -~ 0.5;
#X obj 100 331 clip~ -0.5 0.5;
#X obj 100 305 *~ 1;
#X obj 152 272 moses 1;
#X msg 115 272 1;
#X obj 100 361 cos~;
#X obj 97 112 wrap~;
#X obj 97 146 -~ 0.5;
#X obj 100 419 *~ -0.5;
#X obj 100 389 -~ 1;
#X floatatom 152 234 0 0 0;
#X text 162 78 subtracting 0.5 and wrapping produces a sawtooth wave
180 degrees out of phase from the original.;
#X text 156 139 as before we subtract 1/2 again to center the sawtooth
from -1/2 to 1/2.;
#X text 212 234 <-- sharpness (at least 1);
#X obj 97 50 inlet~;
#X obj 100 455 outlet~;
#X obj 152 208 inlet;
#X connect 0 0 6 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 3 1 2 1;
#X connect 4 0 2 1;
#X connect 5 0 9 0;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 15 0;
#X connect 9 0 8 0;
#X connect 10 0 3 0;
#X connect 14 0 0 0;
#X connect 16 0 10 0;
#X restore 36 122 pd envelope;
#X floatatom 146 124 0 0 0;
#X text 187 123 <-- envelope sharpness;
#X obj 74 304 line~;
#X obj 74 246 * 441;
#X floatatom 174 215 0 0 0;
#X obj 74 275 pack 0 100;
#X text 216 214 <-- read point in 100ths of a second;
#X obj 55 338 +~;
#X text 31 529 In this patch we can loop in any "window" of the input
sample. The "read point" (0-100) gives the starting point of the window
and "chunk" is its size (both in 100ths of a second.) Try \, for example
\, frequency 4 \, sharpness 10 \, chunk size 25 \, and vary the read
point from -25 to 100 \, listening to the result.;
#X text 220 246 <-- graph table index;
#X text 34 627 You should hear some doppler shift as you change the
read point. To see why \, click on "graph table index" and quickly
start changing the read point--- you should see entertaining pictures
in "table-index". THe next patch shows how to prevent this if you wish
to.;
#X text 763 356 ----- 1 second ------;
#X obj 602 583 loadbang;
#X text 711 597 v-- re-read the original sample;
#X msg 602 670 \; graph2 ylabel 48000 0 44100;
#X msg 662 619 read ../sound/voice.wav sample-table;
#X obj 662 643 soundfiler;
#X text 766 719 updated for Pd version 0.33;
#X text 755 151 ---- 44103 samples ---;
#X connect 5 0 6 1;
#X connect 6 0 5 0;
#X connect 7 0 6 2;
#X connect 9 0 6 0;
#X connect 10 0 28 1;
#X connect 11 0 17 0;
#X connect 13 0 14 0;
#X connect 14 0 15 1;
#X connect 15 0 16 0;
#X connect 16 0 37 0;
#X connect 17 0 15 0;
#X connect 17 0 29 0;
#X connect 18 0 27 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 23 0 22 0;
#X connect 28 0 9 0;
#X connect 29 0 28 0;
#X connect 30 0 29 1;
#X connect 32 0 37 1;
#X connect 33 0 35 0;
#X connect 34 0 33 0;
#X connect 35 0 32 0;
#X connect 37 0 27 0;
#X connect 37 0 10 0;
#X connect 42 0 44 0;
#X connect 42 0 45 0;
#X connect 45 0 46 0;