This post is part of a series of notes and exercises for a summer camp on making musical instruments with Arduino and Pure Data.
Let’s start with a patch that adds two numbers and shows their sum. Using three Numbers and one Object, create this program:
Connect up the outlets and inlets as shown.
Leave Edit Mode and experiment by dragging on the number inputs. What do you notice? Be thorough, and you are bound to discover something interesting…Let’s compare our findings.
This mismatching behavior is how Pure Data is designed. The first inlet to an object is called the hot inlet. All others are cold inlets. Changes on hot inlets force downstream updates. Changes on cold inlets do not.
There are reasons for this hot/cold behavior that we can discuss later—when you’re older. (Read: I don’t fully know either.) But we don’t always want it.
We saw earlier that changes to cold inlets do not cause downstream updates. Sometimes we want these updates to happen. One workaround to is to add a
After we change the second number, we just press the
bng button to reissue the unchanged first number—which causes the sum to update. This
bng fixes our update problem, but it is annoying.
A better solution is to use a
trigger object. When a value enters the inlet of a
trigger, the trigger fires off a sequence of values through its outlets:
The trigger here spits out a
bang and a
float. Importantly, it does so in reverse order. First, the
float outlet sends the number along unchanged to the cold inlet of the
plus object. Second, the
bang outlet sends a pulse to the hot inlet of the
As you can see, a
trigger can make a cold inlet behave like a hot inlet. This dynamic of hot vs. cold will be important to remember throughout the week. We’ll see