Developing a patcher of any complexity will usually result in a dense web of objects and patch cords. We will talk from time to time about how to make our patchers more visually appealing, clear, and easier to understand.
send and receive, and self-commenting patchers
Having to loop patch cords from the bottom of a patcher back around to the top, or from one corner to another can create difficulties with visual recognition of patcher flow. The send and receive objects (usually abbreviated s and r) allow you to send messages without patch cord connections. They offer the added bonus of what programmers call, self commenting code.
To make the invisible connection between a send object and any number of receive objects, you have to use matching names as the object argument. If you use a name that relates to the message being sent, then you have created an object that is its own comment. For example, if I want to send a note number from a MIDI keyboard to different places in my patcher, I can use an argument like “noteInput,” or “pitch,” or “midiNote.” I then can more easily see the what the message being sent represents.
The only thing to watch for with send and receive objects is that they will send to other patchers – other open patchers, and any sub-patchers within any open patchers.
encapsulation with patcher
The patcher object (p) allows you to embed sub-patchers within your patcher. Using sub-patchers can greatly reduce object clutter, moving a collection of objects that typically performs one function (to select intervals, for example) and place them within a single object.
The patcher object requires an argument for the sub-patcher name. Once you add a patcher object, an editing window for the sub-patcher will automatically open. It functions just like the parent (or main) patcher you are working on. You can lock and unlock it for editing. All the guides and help works. And you can cut/copy/paste objects to and from it. Use the cut/paste functions to select the objects from the main patcher and move them to the sub-patcher. You have no control over where the objects will appear once pasted into the new patcher. Just know that the pasted objects will all be selected after pasting, and if you grab any of the selected objects they will all move together to a location of your choice.
To messages into and out of a patcher (sub-patcher) object you use inlet and outlet objects within the sub-patcher. The order that the inlets/outlets appear on the patcher object is determined by their placement within the sub-patcher. The objects will display a number to show you their relative location. Moving the inlets and outlets can cause their order to change.
Use the Comments attribute to set a programming hint that will appear when you hover your mouse over the inlets/outlets of the patcher object. You can set/change this attribute by selecting the object, then opening its inspector (tab or window). Double-click in the field to the right of Comment and you can type any text.
It is useful to still have number boxes or other message display objects leading into and out of a patcher object in order to verify that the data is what you expect. You can also use send and receive objects to move messages into and out of a patcher object, but doing so can sometimes lead to duplicate labels for send and receive objects in different patchers that are meant to handle different messages. I generally discourage using send/receive with sub-patchers for beginning Max programmers.
Leave a Reply