#N canvas 278 23 993 662 12;
#X msg 688 78 dsp \$1;
#X msg 576 91 \; pd dsp 0;
#X text 712 49 turn DSP engine on/off;
#X msg 576 49 \; pd dsp 1;
#X msg 56 309 \; pd compatibility 0.52;
#X text 29 147 The 'compatibility' message takes a version number and sets the behavior of some objects back to that particular version. This can be useful in some cases if you want to guarantee that your patch will work in the same way as in the version you created it. This is because sometimes a new version of Pd may promote a change in the behavior of the object (usually to fix a bug) that can also break or change the result of a patch., f 62;
#X text 35 376 Objects that change their behavior according to the set compatibility have that information in their help file.;
#X text 45 288 set compatibility to Pd 0.52;
#X text 273 277 set to Pd 0.49;
#X text 107 422 For example \, check the help file of:, f 18;
#X obj 258 431 wrap~;
#X obj 259 553 trace;
#X msg 54 545 \; pd set-tracing \$1;
#X obj 54 506 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#N canvas 654 117 712 610 fast-forward 0;
#X msg 176 449 stop;
#X obj 176 415 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 176 342 trigger float float bang, f 25;
#X msg 262 423 fast-forward \$1;
#X obj 262 456 send pd;
#X obj 176 380 delay;
#X msg 92 213 \; pd dsp 1;
#X floatatom 176 311 5 0 8000 0 - - - 0;
#X text 376 422 <=;
#X text 152 381 =>;
#X text 219 310 <= set other lengths;
#X text 83 311 milliseconds:;
#X text 65 380 sends a bang after the time amount, f 12;
#X text 86 449 stops the => recording, f 12;
#X text 397 415 tells pd to 'fast-forward' and render a given amount of time in ms, f 35;
#X text 175 558 records to the array =>;
#X msg 348 373 start 88200;
#X obj 348 557 tabwrite~ fast-forward;
#X msg 176 268 6000;
#N canvas 0 22 450 278 (subpatch) 0;
#X array fast-forward 441000 float 2;
#X coords 0 1 441000 -1 250 120 1 0 0;
#X restore 391 209 graph;
#X obj 371 463 noise~;
#X text 423 463 <= white noise generator;
#X obj 371 522 *~;
#X obj 389 493 osc~ 0.2;
#X text 406 522 amplitude modulation;
#X text 216 266 <= time amount to render (6 seconds), f 19;
#X text 164 214 <= First make sure DSP is on, f 15;
#X text 458 335 --- 10 sec ---;
#X text 82 22 Pd is mostly used to generate and process things in realtime \, nonetheless \, the "fast-forward" message allows you to 'render' an amount of audio faster than realtime (and as fast as your process can handle) - this is also called 'batch processing'. In this example we use it to record 6 seconds of amplitude modulation white noise into an array., f 76;
#X text 439 367 start recording 2 seconds into the table, f 25;
#X text 82 105 This is very useful if you want to process a pre recorded audio in a Pd patch or to generate an audio file with a generative (or automated) patch. You can also use [soundfiler] to export to a sound file or direcctly use [writesf~] instead. The 'fast-forward' message takes a time in milliseconds to fast forward to. Check the example, f 76;
#X connect 0 0 17 0;
#X connect 1 0 0 0;
#X connect 2 0 5 0;
#X connect 2 1 3 0;
#X connect 2 2 16 0;
#X connect 3 0 4 0;
#X connect 5 0 1 0;
#X connect 7 0 2 0;
#X connect 16 0 17 0;
#X connect 18 0 7 0;
#X connect 20 0 22 0;
#X connect 22 0 17 0;
#X connect 23 0 22 1;
#X restore 793 312 pd fast-forward;
#N canvas 519 109 807 507 other-messages 0;
#X msg 509 394 \; pd quit;
#X obj 142 182 pdcontrol;
#X msg 142 154 dir;
#X obj 460 415 s pd;
#X msg 460 388 quit;
#X msg 546 155 \; pd verifyquit;
#X text 523 104 Quits Pd but verifies if there are unsaved changes, f 25;
#X text 37 74 The "open" message opens a Pd file and takes two symbols \, the first is the Pd filename and the second is the directory where it lives. You can use this to open desired patches from within a patch., f 53;
#X msg 142 212 \; pd open help-intro.pd \$1;
#X obj 136 411 pdcontrol;
#X msg 136 383 dir;
#X msg 136 441 \; pd menunew new-patch \$1;
#X text 524 52 And here are some more:;
#X obj 525 230 cnv 15 170 100 empty empty empty 20 12 0 14 #f88c7c #404040 0;
#X text 535 243 WARNING: This will quit and close Pd!!!, f 20;
#X text 553 286 UNSAVED PATCHES WILL BE LOST!!!, f 16;
#X obj 581 388 cnv 15 178 45 empty empty empty 20 12 0 14 #f88c7c #404040 0;
#X text 39 272 The "menunew" message generates a new empty Pd file (but doesn't save it to disk unless you save the file.) It takes two symbols \, the first is the Pd filename and the second is the directory where it will be saved. You can use this for dynamic patching (see next section on parent patch)., f 51;
#X text 42 29 Here are some more messages Pd receives that may be useful., f 31;
#X text 589 392 <-- You've been warned. Do it at your own risk!, f 23;
#X text 212 410 <-- get currently directory;
#X text 218 181 <-- get currently directory;
#N canvas 0 22 450 278 (subpatch) 0;
#X coords 0 1 100 -1 172 102 1;
#X restore 524 229 graph;
#N canvas 0 22 450 278 (subpatch) 0;
#X coords 0 1 100 -1 180 45 1;
#X restore 580 388 graph;
#X connect 1 0 8 0;
#X connect 2 0 1 0;
#X connect 4 0 3 0;
#X connect 9 0 11 0;
#X connect 10 0 9 0;
#X restore 813 390 pd other-messages;
#X text 542 302 The "fast-forward" message to Pd allows batch processing. Open the subpatch for an example., f 32;
#X text 513 380 Here are some other maybe interesting (maybe not) messages you can send to Pd., f 41;
#X text 22 627 see also:;
#X obj 139 627 samplerate~;
#X obj 97 627 send;
#X obj 539 247 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 539 214 receive pd-dsp-started;
#X obj 753 214 receive pd-dsp-stopped;
#X text 561 246 when DSP is turned on;
#X text 776 247 when DSP is turned off;
#X obj 228 627 namecanvas;
#X msg 314 627 message;
#X obj 77 24 cnv 15 242 27 empty empty Messages\ you\ can\ send\ to\ Pd: 11 14 0 14 #e0e0e0 #404040 0;
#X obj 518 440 cnv 15 420 27 empty empty Messages\ you\ can\ send\ to\ Patch\ windows\ (canvases) 15 14 0 14 #e0e0e0 #404040 0;
#X obj 518 467 cnv 15 420 27 empty empty (aka\ Dynamic\ patching): 117 12 0 14 #e0e0e0 #404040 0;
#N canvas 565 169 779 412 Dynamic-Patching 0;
#N canvas 338 52 659 663 creating-boxes 0;
#X obj 91 523 send pd-creating-boxes;
#X text 19 22 The 'obj' message creates objects boxes. It needs to be followed by a pair of x/y coordinates and then the object name followed by creation arguments (if necessary)., f 60;
#X msg 51 337 obj 470 35 float 5;
#X msg 69 365 msg 470 80 a message box;
#X msg 90 394 floatatom 470 120 \, symbolatom 470 140 \, listbox 470 160, f 19;
#X msg 107 453 text 470 190 a comment;
#X msg 120 486 obj 470 225 bng;
#X text 20 223 IEMGuis can be created as objects (such as [bng] for bang as the example below). An argument list is not documented yet \, you can check the source code but it also makes sense to connect a receive object to it and set its parameters with the documented methods (it's surely more readable).;
#X text 317 329 The arguments for the float/number/list boxes are the same. Just note that the limit values are invalid for the symbol box., f 39;
#X msg 387 386 \; pd-creating-boxes floatatom 100 570 7 -40 40 3 label r-sym s-sym 16, f 26;
#X text 318 407 click =>;
#X text 66 311 click these:;
#X text 19 74 The 'msg' message creates message boxes. After a pair of x/y coordinates you can specify the message's content.;
#X text 20 126 The 'floatatom' \, 'symbolatom' and 'listbox' message create \, respectively \, number \, symbol and list boxes. After a pair of x/y coordinates you can specify arguments (see below).;
#X text 20 187 The 'text' message creates a comment. After a pair of x/y coordinates you can specify the comment's content., f 60;
#X text 332 479 Arguments are \; - width (default 0 if created like this) \; - lower limit (default 0) \; - higher limit (default 0) \; - label position (0 <default>: left \, 1: right \, 2: top \, 3: bottom) \; - label symbol (default empty symbol) \; - receive symbol (default empty) \; - send symbol (default empty) \; - font size (default: 0 <auto>), f 42;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 0 0;
#X connect 6 0 0 0;
#X restore 181 294 pd creating-boxes;
#N canvas 778 286 529 443 loadbang 0;
#X obj 94 331 s pd-loadbang-example;
#N canvas 376 356 304 192 loadbang-example 0;
#X restore 307 196 pd loadbang-example;
#X text 63 112 Creating a [loadbang] object itself via dynamic patching also doesn't make it fire. So you may also need to send a 'loadbang' message afterwards., f 58;
#X msg 114 263 loadbang;
#X msg 94 197 clear \, obj 100 100 bng \, obj 100 75 loadbang \, connect 1 0 0 0 \, vis 1, f 23;
#X text 55 372 The 'loadbang' message will fire [loadbang] objects that are place in the named canvas and also in subwindows of that canvas \, but not other loadbang objects elsewhere.;
#X text 184 264 fire loadbang;
#X msg 133 300 clear \, vis 0;
#X obj 341 327 s pd-loadbang;
#X msg 341 298 loadbang;
#X text 331 257 also work for subpatches., f 13;
#X text 63 42 A 'loadbang' message will make [loadbang] objects output a bang. This is useful because when you create abstractions that contain a loadbang object \, they don't get fired \, so you have to force fire after they get created ., f 58;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 7 0 0 0;
#X connect 9 0 8 0;
#X restore 589 290 pd loadbang;
#X obj 295 181 namecanvas;
#N canvas 461 65 592 579 Data-Structures 0;
#X msg 141 491 clear;
#X msg 41 364 vis \$1;
#X obj 41 334 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#N canvas 523 391 191 85 ds2 0;
#N canvas 50 470 557 157 template-toplevel 0;
#X obj 21 94 plot bazoo 700 3 10 20 20;
#X obj 21 68 drawpolygon q 4 0 0 20 z z -5 10 20;
#X obj 21 30 struct template-toplevel float x float y float z float q array bazoo template-element;
#X restore 11 11 pd template-toplevel;
#N canvas 199 231 600 239 template-element 0;
#X obj 58 83 drawpolygon 10 2 5 0 0 -5 -5 0 0 5 5 0;
#X obj 59 48 struct template-element float x float y float w;
#X restore 11 34 pd template-element;
#X restore 407 456 pd ds2;
#X text 65 334 show/hide;
#N canvas 361 282 477 221 ds 0;
#X obj 52 45 filledcurve 990 0 1 0 0 50 0 50 50 0 50;
#X obj 52 72 drawcurve 0 1 15 15 20 15 20 20 15 20 15 15;
#X obj 52 99 drawcurve 0 1 30 15 35 15 35 20 30 20 30 15;
#X obj 52 126 filledcurve 999 0 1 10 25 25 45 40 25 25 35 10 25;
#X obj 54 17 struct ds float x float y symbol sym;
#X obj 52 153 drawsymbol sym 55 25 0;
#X restore 456 401 pd ds;
#X msg 100 366 scalar ds 225 225 -hi_there!!;
#X text 317 362 add data structure scalar 'ds' (see [pd ds]) and 3 fields., f 30;
#X msg 117 407 read ds-text.txt;
#X text 187 492 clean it up;
#X msg 127 432 write ds-text-2.txt;
#X obj 141 466 loadbang;
#N canvas 164 235 514 421 \$0-DS-example 0;
#X restore 337 312 pd \$0-DS-example;
#X obj 102 526 s pd-\$0-DS-example;
#X text 66 242 Note you can also use "\$0" to give local names to subpatches. This is useful for abstractions in general. In this case we need to use [send] as "\$0" doesn't work in messages., f 61;
#X text 70 14 A 'vis 1' message shows the window while 'vis 0' hides it. The 'read' and 'write' messages can be used to import and export contents of a window (used for Data Structures). The 'clear' message clears the contentes of a window whatever they are (objects \, Data Structures \, arrays \, anything). A 'scalar' message adds a Data Structure scalar to the window., f 62;
#X text 216 312 click to open =>;
#X text 271 431 read/write from/to text (see [pd ds2]);
#X text 70 109 For more on Data Structures \, check section 4.data.structures in Pd's tutorial examples.;
#X obj 91 166 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#N canvas 491 316 412 249 open 0;
#X obj 58 49 inlet;
#X obj 58 105 pdcontrol;
#X msg 58 78 dir;
#X msg 58 132 \; pd open 01.scalars.pd \$1/../4.data.structures;
#X connect 0 0 2 0;
#X connect 1 0 3 0;
#X connect 2 0 1 0;
#X restore 91 196 pd open;
#X text 115 165 <-- open first example of the 4.Data.Structure section;
#X connect 0 0 13 0;
#X connect 1 0 13 0;
#X connect 2 0 1 0;
#X connect 6 0 13 0;
#X connect 8 0 13 0;
#X connect 10 0 13 0;
#X connect 11 0 0 0;
#X connect 19 0 20 0;
#X restore 288 367 pd Data-Structures;
#N canvas 691 48 597 554 (dis)connecting-boxes 0;
#X obj 79 482 send pd-connect-boxes;
#N canvas 413 247 259 224 connect-boxes 0;
#X restore 357 477 pd connect-boxes;
#X msg 79 263 clear \, obj 70 40 bng \, obj 70 80 float 5 \, floatatom 70 120 \, vis 1, f 40;
#X text 85 237 clear \, create objects and show window:;
#X msg 109 326 connect 0 0 1 0;
#X text 229 318 connect object's 0 (bang) first outlet to object's 1 (float) first inlet., f 38;
#X text 240 362 connect object's 0 (bang) first outlet to object's 1 (float) first inlet., f 38;
#X msg 119 369 connect 1 0 2 0;
#X msg 145 445 clear \, vis 0;
#X msg 131 411 disconnect 0 0 1 0 \, disconnect 1 0 2 0;
#X text 416 411 same syntax.;
#X text 71 29 You can connect a pair of objects by using two pairs of numbers. The first pair identifies the object number and the outlet number. The second pair identifies the object number and inlet number to connect to. The 'disconnect' message has the same syntax., f 67;
#X text 71 94 The object's number is defined by its order of creation (indexed from 0). Every element in the patch counts (number boxes \, message boxes \, arrays and even comments). Inlets and outlets are also indexes from 0 \, by the way., f 67;
#X text 71 160 Being aware of an object number can be hard and tricky. The best way to control this is start a patch or subpatch from scratch. This way \, you can more easily know the number of the object by the order they were created., f 67;
#X connect 2 0 0 0;
#X connect 4 0 0 0;
#X connect 7 0 0 0;
#X connect 8 0 0 0;
#X connect 9 0 0 0;
#X restore 545 93 pd (dis)connecting-boxes;
#X text 593 244 loadbang handling:, f 9;
#N canvas 509 124 849 512 save 0;
#X msg 326 121 menusave;
#X msg 367 171 menusaveas;
#X msg 386 221 menuclose;
#X obj 76 206 pdcontrol;
#X msg 76 178 dir;
#X msg 76 236 \; pd menunew new-example \$1;
#X obj 367 437 s pd-new-example;
#X text 398 108 this will save and create the patch in the directory you created. It'll also rewrite if it's already saved., f 39;
#X text 453 163 opens a dialog for you to choose where to save., f 24;
#X obj 96 379 s pd-new-example;
#X msg 96 350 text 100 100 very nice;
#X msg 411 399 vis \$1;
#X obj 411 369 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#X text 480 366 note 'vis 0' doesn't close the patch \, just hides it (and shows it too if it's opened)., f 31;
#X text 113 326 add something;
#X obj 405 273 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#X msg 405 303 dirty \$1;
#X text 466 214 Depending if changes were made with some dynamic patching messages \, it closes without saving., f 48;
#X text 55 120 So first let's send a message to Pd to create a new patch/canvas., f 32;
#X text 151 37 In this example we are sending messages to the main window of a different patch that we first create.;
#X text 478 267 Note that Pd won't ask you either to save changes in the same case as above. To make sure it asks \, you can use 'dirty 1'. Conversely \, 'dirty 0' makes Pd ignore changes you made and doesn't ask you to save when you close., f 47;
#X text 110 177 <-- go;
#X connect 0 0 6 0;
#X connect 1 0 6 0;
#X connect 2 0 6 0;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 10 0 9 0;
#X connect 11 0 6 0;
#X connect 12 0 11 0;
#X connect 15 0 16 0;
#X connect 16 0 6 0;
#X restore 659 359 pd save;
#X text 527 350 Other messages (saving a patch):, f 17;
#X text 92 347 clear \, vis \, read \, write \, scalar (Data Structures) and "\$0":, f 34;
#X text 31 21 You can communicate with a Pd window by sending messages to the name of the file (which communicates to the main window of a patch or abstraction). You can also communicate with a subpatch's window by sending messages to the subpatch's name. In both cases you need to precede the send name with 'pd-'. In the case of abstractions \, you also need to end with ".pd". Alternatively you can name a main window or a subpatch with [namecanvas]. For reference \, please refer to the help file of [namecanvas] \, which carries complementary information!, f 65;
#N canvas 527 328 801 383 abstractions 0;
#X text 46 29 You can create abstractions just like you would create any other object in Pd! All you need to do is have the name of the abstraction as the object name., f 48;
#X obj 102 162 send pd-abstractions;
#X msg 102 122 obj 150 220 help-intro;
#X text 269 121 <= click;
#X text 55 265 In this example we loaded another Pd file as an abstraction that resides on the same folder. In this case it's not an actual object (and used as such) \, but another patch used in Pd's documentation., f 48;
#X obj 512 214 send pd-help-intro.pd;
#X msg 512 182 vis \$1;
#X obj 512 154 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#X text 427 41 You probably just want to use [namecanvas] to name an abstraction's window and send messages to it (please \, again \, refer to its help file). But you can also use the abstraction's file name to send it messages. In this case you need to end with ".pd" \, see below:, f 46;
#X text 458 266 This can be particularly important for handling "loadbangs" as the next example on the parent patch shows., f 40;
#X connect 2 0 1 0;
#X connect 6 0 5 0;
#X connect 7 0 6 0;
#X restore 576 193 pd abstractions;
#X text 31 217 Many of the menu entries in Pd end up making Pd send a message to a canvas name. For instance \, when you create an object or message box. See example below for creating 'boxes'., f 62;
#X text 584 148 handling abstractions:, f 13;
#X text 521 49 You can connect and disconnect boxes. See subpatch below:, f 30;
#X text 99 166 For reference \, please check the help file of -->, f 26;
#X restore 695 569 pd Dynamic-Patching;
#X text 87 500 The set-tracing message is useful for debugging with the [trace] object. Check its help file., f 47;
#X text 508 156 Note you can get a bang message sent by Pd when DSP starts or stops if you receive from 'pd-dsp-started' and 'pd-dsp-stopped'., f 65;
#X text 601 519 Open subpatch for documentation on how to send messages to to a patch window:, f 38;
#X obj 265 326 send pd;
#X text 29 74 We can use both the [send] object or message boxes to send messages to Pd. Here are some messages that makes sense for you to send to Pd from within a patch. Conversely \, you can also send Pd these messages via Pd's command line., f 62;
#X obj 688 107 send pd;
#X msg 265 299 compatibility 0.49;
#X text 780 624 updated for Pd version 0.52;
#X text 518 13 The message "dsp 1" turns DSP on and "dsp 0" turns it off.;
#X obj 753 247 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 688 50 tgl 19 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000 0 1;
#X obj 5 615 cnv 1 984 1 empty empty empty 8 12 0 13 #000000 #000000 0;
#N canvas 0 22 450 278 (subpatch) 0;
#X coords 0 1 100 -1 244 28 1;
#X restore 76 24 graph;
#N canvas 0 22 450 278 (subpatch) 0;
#X coords 0 1 100 -1 421 54 1;
#X restore 517 441 graph;
#X connect 0 0 37 0;
#X connect 13 0 12 0;
#X connect 22 0 21 0;
#X connect 23 0 41 0;
#X connect 38 0 35 0;
#X connect 42 0 0 0;
