aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/5.reference/block~-help.pd
blob: 97e2207b17e4e3b6dd1f596240a90f1a91c69253 (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
#N canvas 0 0 603 672 12;
#X obj 48 10 block~;
#X text 112 11 (and switch~) - block size and on/off control for DSP
;
#X text 44 40 The block~ and switch~ objects set the block size \,
overlap \, and up/down-sampling ratio for the window. (The overlap
and resampling ratio are relative to the super-patch.);
#X text 45 230 You may have at most one block~/switch~ object in any
window.;
#X text 45 176 A switch~ with no arguments does not reblock audio computation
-- in other words \, block size and sample rate are as in the parent
patch.;
#X text 46 531 see also:;
#X obj 134 531 fft~;
#X text 44 567 ... and the control.blocksize and up.downsampling audio
example patches.;
#X text 194 459 <--- example usage in subpatch;
#X text 43 92 Switch~ \, in addition \, allows you to switch DSP on
and off for the window. All subwindows are also switched. (If a subwindow
of a switched window is also switched \, both switches must be on for
the subwindow's audio DSP to run. Pd's global DSP must also be on.)
;
#N canvas 372 9 695 365 block-example 0;
#X obj 258 238 bang~;
#X obj 258 264 t b b;
#X obj 258 290 timer;
#X floatatom 258 319 5 0 0 0 - - -;
#X obj 54 30 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X msg 78 53 set 4096 1 1;
#X msg 78 108 set 4096 2 1;
#X msg 78 79 set 8192 1 1;
#X msg 81 138 set 4096 1 0.5;
#X msg 81 165 set 4096 1 2;
#X obj 52 192 switch~ 4096 1 1;
#X obj 258 347 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 94 25 <--- switch this subpatch on and off;
#X text 209 53 <--- block size 4096 \, no overlap \, no resampling
;
#X text 206 81 <--- bigger block size;
#X text 208 109 <--- double overlap;
#X text 219 142 <--- downsampled by factor of 2;
#X text 218 167 <--- upsampled by factor of 2;
#X text 206 194 <--- creation arguments (if any) initialize blocking
;
#X text 317 317 <--- measured time (msec) between blocks;
#X text 245 209 (args are blocksize \, overlap \, up/downsampling)
;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 1 2 1;
#X connect 2 0 3 0;
#X connect 3 0 11 0;
#X connect 4 0 10 0;
#X connect 5 0 10 0;
#X connect 6 0 10 0;
#X connect 7 0 10 0;
#X connect 8 0 10 0;
#X connect 9 0 10 0;
#X restore 41 457 pd block-example;
#N canvas 112 205 599 297 block-interations 0;
#X text 32 61 Dac~ and adc~ don't work correctly if reblocked \, nor
if a parent window is reblocked \, even if the window containing the
dac~ or adc~ is reblocked back to the default block size and sample
rate.;
#X text 33 209 Patches using send~/receive~ or throw~/catch~ to intercommunicate
must have the same blocking -- and if their parents are blocked bigger
than they are \, there might be wierdness.;
#X text 31 128 If using send~ or delwrite~ from a switched-off patch
\, the output of corresponding receive~ and delread~ objects in other
\, running patches will cycle old input (and sound like garbage). Throw~
may be switched with impunity \, but not catch~.;
#X text 32 11 INTERACTIONS BETWEEN BLOCK~/SWITCH~ AND OTHER OBJECTS
IN PD;
#X restore 40 482 pd block-interations;
#X text 44 269 Pd's default block size is 64 samples. The inlet~ and
outlet~ objects reblock signals to adjust for differences between parent
and subpatch \, but only power-of-two adjustments are possible. So
for "normal" audio computations \, all blocaks should also be power-of-two
in size. HOWEVER \, if you have no inlet~ or outlet~ you may specify
any other block size. This is intended for later use in video processing.
;
#X text 45 395 Switch~ takes a "bang" message that causes one block
of DSP to be computed. This might be useful for pre-computing waveforms
or window functions \, or also for video processing.;
#X text 198 484 <-- BUG!! block~/switch~ and dac~/adc~ are incompatible
;
#N canvas 0 0 581 315 block-interations 0;
#X text 32 11 You can use the switch~ object to single-step dsp in
a subpatch. This might be useful for block operations that don't want
to be synced to the sample clock: loading a wondiw function in a table
\, or copying one table to another:;
#X obj 136 193 noise~;
#X obj 136 225 tabwrite~ zzzz;
#X obj 33 154 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#N canvas 0 0 450 300 (subpatch) 0;
#X array zzzz 256 float 2;
#X coords 0 1 256 -1 256 140 1;
#X restore 300 116 graph;
#X obj 33 228 switch~ 256;
#X text 25 111 turn DSP on and click to;
#X text 26 127 randomize the table at right:;
#X connect 1 0 2 0;
#X connect 3 0 2 0;
#X connect 3 0 5 0;
#X restore 40 505 pd block-interations;
#X text 198 506 <-- wierd 'bang' feature lets you single-step DSP;
#X text 337 604 updated for Pd version 0.43;