#N canvas 558 23 531 684 12;
#X text 15 597 see also:;
#X obj 135 649 fft~;
#N canvas 603 316 560 207 block-interactions 0;
#X text 32 11 INTERACTIONS BETWEEN BLOCK~/SWITCH~ AND OTHER OBJECTS IN PD;
#X text 32 106 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 restore 155 541 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 164 tgl 19 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 19 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 65 164 <-- 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 155 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 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#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 227 tabwrite~ noise;
#X obj 36 227 switch~ 4096;
#X obj 278 117 cnv 19 254 138 empty empty empty 20 12 0 12 #ffffff #404040 0;
#N canvas 0 22 450 300 (subpatch) 0;
#X array noise 4096 float 2;
#X coords 0 1 4096 -1 256 140 1 0 0;
#X restore 277 116 graph;
#X connect 1 0 5 0;
#X connect 2 0 5 0;
#X connect 2 0 6 0;
#X restore 155 515 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 msg 24 527 \; pd dsp \$1;
#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 570 343 reference 0;
#X obj 9 92 cnv 5 550 5 empty empty INLET: 8 18 0 13 #202020 #000000 0;
#X obj 9 210 cnv 2 550 2 empty empty OUTLETS: 8 12 0 13 #202020 #000000 0;
#X obj 9 247 cnv 2 550 2 empty empty ARGUMENTS: 8 12 0 13 #202020 #000000 0;
#X obj 8 322 cnv 5 550 5 empty empty empty 8 18 0 13 #202020 #000000 0;
#X text 100 107 float -;
#X text 129 219 NONE;
#X text 107 141 bang -;
#X text 68 176 set <list> - set argument values (size \, overlap \, up/downsampling)., f 66;
#X text 136 257 1) float - set block size (default 64).;
#X text 135 277 2) float - set overlap for FFT (default 1).;
#X text 135 297 3) float - up/down-sampling factor (default 1).;
#X obj 26 27 block~;
#X text 95 26 - set block size \, overlap and up/downsampling;
#X text 22 56 [switch~];
#X text 96 56 - also switch subpatches if invoked as [switch~];
#X text 159 107 in the case of [switch~] \, nonzero turns DSP on for the containing window \, zero turns DSP off., f 53;
#X text 159 141 in the case of [switch~] \, when turned off \, computes just one DSP cycle on the containing window., f 53;
#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 282 489 <-- click and open example;
#X text 265 515 <-- 'bang' lets you single-step DSP;
#X text 313 541 <-- BUG! incompatibilities;
#X text 341 558 to other objects, f 22;
#X obj 24 492 set-dsp-tgl;
#X text 55 496 DSP on/off;
#X text 318 649 updated for Pd version 0.54;
#X connect 28 0 9 0;
