Creating a Subpatch

A subpatch is a patch that works as a reusable component. It is stored as a separate file and can be loaded into another patch, called the parent patch. It can have inlets and outlets just like the other objects we’ve worked with so far. It can also draw part of its canvas on its parent patch, which is great for exposing user-interface elements to control the subpatch. We’ll turn the simple graph we just made into a subpatch, so you’ll be able to add it to any patch quickly to view a signal.

Create a new patch and save it to a directory of your choice. Call the patch grapher~, which will create a file called grapher~.pd. Note that we used the suffix ~ to indicate that this subpatch takes a signal input. The suffix is not ...

Get Programming Sound with Pure Data now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.