Tutorial 2 - Send and receive with graphical objects
Send and Receive
The send and receive mechanism in PD provides a wireless message communication system, a way of sending data from place to place, patch to subpatch, etc, without making cable connections. There are several ways to do this: with send/receive objects, with message boxes and semicolon separated values, from one graphical object to another within its properties, and from a qlist (an advanced topic we will get to in a future tutorial). Please see PD's Help system, "2.control.examples/send_and_receive.pd" for examples of the first two.
The third, sending and receiveing to/from graphical objects, is very handy but somewhat problematic. One of the stated goals of PD is to have printable patches with all of the logic visible. This is a great idea for examples and tutorials like this one. However, when building interfaces for performance, it is often useful to hide the wires, showing the performer only wht they need to execute the piece. Graphical send/receive is a perfect solution.
Properties of graphical objects
To find these send/receive pairs, just right-click on any GUI object (numbers, sliders, VU, radios, etc) and choose "Properties". You will be greeted with a dialog box with many options, depenind on the object. We're interested in the send receive section. Below is the send/receive section of a "bang" GUI object.
Here, adding a name, for example "go" to the send field. Now our "bang" GUI will send a "bang" to the receive "go". If we create another "bang" GUI object and set it's receive field to "go", the first "bang" GUI will "bang" the second.
Any graphical object can communicate with any other in this way. Send messages fro GUI opbjects can also be received at an ordinary [receive] object as well. The send/receive names simply have to match.
Example patch
Attached is an example of communicating numbers to and from graphical objects across subpatches, in this case to do exactly what I stated earlier, to hide the "guts" of the patch from the user/performer. In this patch, sliders on the front page send values to the frequency of an amplitude modulator (ring modulator) and to the volume of the overall outlut. Two VU's on the front page also receive the signal level from the patch's "guts", giving the performer visual feedback about what's happening to the audio.
For fun, I have added an extra trick, using semicolon delimited messages to send numbers into the Properties dialog directly. See the numbers displayed on top of the graphical sliders as well as the message system under the hood (click on [pd guts]).
| Attachment | Size |
|---|---|
| gui_simple-ringmod.pd | 1.78 KB |
