#N canvas 504 23 531 684 12;
#X text 15 597 see also:;
#X obj 135 649 fft~;
#X text 318 649 updated for Pd version 0.43;
#N canvas 603 316 571 253 block-interactions 0;
#X text 32 11 INTERACTIONS BETWEEN BLOCK~/SWITCH~ AND OTHER OBJECTS
IN PD;
#X text 32 156 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~]., f 69
;
#X text 32 39 The [dac~] and [adc~] don't work correctly if reblocked
to a size other than 64! They also don't work if a parent window is
reblocked and the window containing the [dac~] or [adc~] is reblocked
back to the default block size and sample rate!, f 69;
#X text 32 104 Patches using [send~]/[receive~] or [throw~]/[catch~]
must also have the default 64 block size -- and if their parents are
blocked bigger than they are \, there might be weirdness., f 69;
#X restore 149 540 pd block-interactions;
#N canvas 741 59 537 534 switch-example 0;
#X obj 109 380 bang~;
#X obj 109 406 t b b;
#X obj 109 432 timer;
#X floatatom 109 461 8 0 0 0 - - - 0;
#X obj 42 169 tgl 17 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000
0 1;
#X msg 54 199 set 4096 1 1;
#X msg 69 247 set 4096 2 1;
#X msg 62 223 set 8192 1 1;
#X msg 76 270 set 4096 1 0.5;
#X msg 83 293 set 4096 1 2;
#X obj 109 489 bng 17 50 10 0 empty empty empty 0 -6 0 8 #dfdfdf #000000
#000000;
#X text 186 347 (args are blocksize \, overlap \, up/downsampling)
;
#X obj 42 332 switch~ 4096 1 1;
#X text 62 167 <-- switch this subpatch on and off;
#X text 165 332 <-- creation arguments (if any) initialize blocking
;
#X text 175 293 <-- upsampled by factor of 2;
#X text 184 270 <-- downsampled by factor of 2;
#X text 164 246 <-- double overlap;
#X text 157 223 <-- bigger block size;
#X text 149 198 <-- block size 4096 \, no overlap \, no resampling
;
#X text 173 462 <-- measured time (msec) between blocks;
#X text 58 15 DSP in this subwindow is turned on and off by the [switch~]
object. Any subwindows of this window can also be switched off here.
If a patch and a superpatch both have switches \, both must be "on"
for DSP to run in the patch., f 61;
#X text 57 83 [switch~] takes optional arguments the same as [block~].
If you supply arguments to [switch~] \, the patch will be switched
AND reblocked., f 61;
#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 10 0;
#X connect 4 0 12 0;
#X connect 5 0 12 0;
#X connect 6 0 12 0;
#X connect 7 0 12 0;
#X connect 8 0 12 0;
#X connect 9 0 12 0;
#X restore 150 489 pd switch-example;
#N canvas 551 180 567 287 switch-bang 0;
#X text 50 15 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 window function in a table
\, or copying one table to another:, f 65;
#X obj 139 183 noise~;
#X obj 36 140 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000
#000000;
#N canvas 0 22 450 300 (subpatch) 0;
#X array noise 256 float 0;
#X coords 0 1 255 -1 256 140 1 0 0;
#X restore 277 116 graph;
#X obj 36 227 switch~ 256;
#X text 38 93 Note: DSP needs to be on;
#X text 62 133 click to randomize the table at right, f 20;
#X obj 139 224 tabwrite~ noise;
#X connect 1 0 7 0;
#X connect 2 0 4 0;
#X connect 2 0 7 0;
#X restore 149 514 pd switch-bang;
#X obj 85 68 block~ 64 1 1;
#X text 85 95 args: block size \, overlap \, up-downsampling;
#X obj 87 597 ../3.audio.examples/G04.control.blocksize;
#X obj 87 619 ../3.audio.examples/J07.oversampling;
#X obj 46 489 tgl 17 0 empty empty empty 17 7 0 10 #dfdfdf #000000
#000000 0 1;
#X msg 46 522 \; pd dsp \$1;
#X text 67 486 <= DSP on/off, f 6;
#X obj 178 649 bang~;
#X text 14 649 and the objects:;
#X obj 5 50 cnv 1 520 1 empty empty empty 8 12 0 13 #000000 #000000
0;
#N canvas 717 115 572 307 reference 0;
#X obj 9 52 cnv 5 550 5 empty empty INLET: 8 18 0 13 #202020 #000000
0;
#X obj 9 170 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000
0;
#X obj 9 207 cnv 2 550 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000
0;
#X obj 8 282 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000
0;
#X obj 26 20 switch~;
#X text 86 20 and [block~];
#X text 183 19 - set block size and on/off control for DSP;
#X text 100 67 float -;
#X text 159 67 in the case of [switch~] \, nonzero turns DSP on \,
zero turns DSP off., f 53;
#X text 129 179 NONE;
#X text 107 101 bang -;
#X text 159 101 in the case of [switch~] \, when turned off \, computes
just one DSP cycle., f 53;
#X text 68 136 set <list> - set argument values (size \, overlap \,
up/downsampling)., f 66;
#X text 136 217 1) float - set block size (default 64).;
#X text 135 237 2) float - set overlap for FFT (default 1).;
#X text 135 257 3) float - up/down-sampling factor (default 1).;
#X restore 369 17 pd reference;
#X text 5 16 [block~] and [switch~] -;
#X text 188 9 set block size and on/off control for DSP, f 22;
#X obj 5 583 cnv 1 520 1 empty empty empty 8 12 0 13 #000000 #000000
0;
#X text 462 18 <= click;
#X text 188 68 [block~] with window's default values;
#X text 34 189 In addition \, [switch~] allows you to switch DSP on
and off for the owning patch window and all of its 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.), f 68;
#X text 34 268 A [switch~] or [block~] object without arguments does
not reblock audio computation - in other words \, block size and sample
rate are as in the parent patch., f 68;
#X text 34 316 [switch~] also takes a "bang" message that computes
one block of DSP if it's switched off. This is useful for pre-computing
waveforms \, window functions or also for video processing., f 68
;
#X text 34 122 The [block~] and [switch~] objects set the block size
\, overlap \, and up/down-sampling ratio for the patch window. (The
overlap and resampling ratio are relative to the super-patch.) You
may have at most one [block~] or [switch~] object in any window.,
f 68;
#X text 34 367 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 blocks 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.
, f 68;
#X text 277 489 <-- click and open example;
#X text 259 514 <-- 'bang' lets you single-step DSP;
#X text 307 540 <-- BUG! incompatibilities, f 26;
#X text 335 557 to other objects, f 22;
#X connect 10 0 11 0;
