Data Flow

Besides data types, Wire has three types of data Flow: Signal, Event and Attribute.

Event flow can be recognized by rectangular in- and outlets and Signal flow can be recognized by circular in-and outlets. Finally, Attribute flow is displayed with diamond shaped in-and outlets.

Signal

A signal flow continuously transmits data at the framerate of the patch. If you hover over a signal outlet, you will always see a value. It’s not possible to have a signal flow without a value. Signal is by far the most used flow type in Wire and is used for everything that has to be updated each frame.


Event

Events are messages that only occasionally happen. This is often used for MIDI or OSC, for example, where there can be a state when there is no message. Events are passed into the patch using an outer process (such as pressing a MIDI button or clicking on a trigger parameter), the event data is sent through the cords. This data flow is then used to trigger a clip, reset a parameter or bypass an effect. After that, the event data is gone, it doesn't exist continuously in the way that signal does. Events can be triggered multiple times in one frame.


Attribute

Attribute cords allow you to change the attributes of nodes. For example: resolution of a texture or the size of a collection.

Attribute flow happens only once: when the patch is compiled. This means that changing the value of an attribute will force Wire to recompile the patch. This goes so fast that you won't notice.

Another way to look at attributes from a more traditional point of programming is to see them as constants. They are only declared once.

Attributes are super useful for changing the size of a collection. Nodes like Sequence, Random,  Linear, Gradient Palette and Grid Pattern love attributes.

Note that attributes can't be animated in Arena/Avenue.


Example

The video player node is an excellent example of all three types of flow. The output of the node is a signal since the video needs to be continuously updated to your screen. 

The inlets of the nodes are mostly events since you only need to start/stop/pause the clip once every input.

The Play Mode is an attribute because it will completely change the behavior of the node.


How to flow

Now you might be like “Uncle Wire, how should I flow?”

Don’t worry about it too much, Wire will often choose the correct variant for you. It is more important to understand the difference between the three when working with Wire.

Events and attributes can always be connected to signal inlets (rectangle/diamond to circle, remember?) but not the other way around directly. You can use the OnChange node to go from Signal to Event.
It is advisable to use events where it makes sense (boolean switches for example) but we won’t punish you for using signals everywhere.

Optimization with attributes (advanced)

Because attributes are only declared once, they can be used to optimize a patch. Imagine using a Linear node with 32 instances to create a collection of floats running from -1 to 1. 

At signal flow your computer calculates this collection every frame. This is useful because it allows you to change the min/max of the Linear node every frame. But now imagine you are using it just once to spread out shapes over an X-axis. 

In this case, switching to attribute flow would save you tons of calculations as we only need to do it once. On the flip side: changing the min/max would force Wire to recompile the patch.


Related Articles