Specifications

2.2 How does Pure Data work? 9
new data streams. To co ns truct a program we place processing objects onto an
empty area called a canvas, then connect them together with wires representing
pathways for data to flow along. On each step of a Pure Data program any
new input data is fed into objects, triggering them to compute a result. This
result is fed into the next connected object and so on until the entire chain of
objects, starting with the first and ending with the last have all been c omputed.
The program then proc e e ds to the next step, which is to do the same thing all
over again, forever. Each object maintains a state which persists throughout
the execution of the program but may change on each step. Message processing
objects sit idle until they receive some data rather than constantly processing a n
empty str e am, so we say Pure Data is an event driven system. Audio processing
objects are always running, unless you explicitly tell them to switch off.
A deeper look at Pd
Before moving on to make some patches consider a quick aside about how Pd
actually interprets its patches and how it works in a wider context. A patch,
or dataflow graph, is navigated by the interpreter to decide when to compute
certain operations. This traversal is right to left and depth first, which is a
computer science way of saying it looks a ahead and tries to go as deep as it
can before moving on to anything higher and moves from right to left at any
branches. This is another way of saying it wants to know what depends on what
befo re deciding to calculate anything. Although we think of data flowing down
the graph the nodes in Fig. 2.4 are number e d to show how Pd really thinks
about things. Most of the time this isn’t very important unless you have to
debug a subtle error.
Pure Data softwar e architecture
Pure Data actually consists of more than one program. The main part called pd
performs all the real work and is the interpreter, scheduler and audio engine. A
separate program is usually launched whenever you s tart the main engine which
is called the pd-gui. This is the part you will interact with when building Pure
Data programs. It creates files to be read by pd and automatically passes them
to the engine. There is a third program called the pd-watchdog which runs
as a c ompletely separate process. The job of the watchdog is to keep an eye on
the execution of programs by the e ngine a nd try to gracefully halt the program
if it runs into serious trouble or exceeds available CPU resources. The context
of the pd program is shown in Fig. 2.5 in terms of other files and dev ice s.
Your first patch
Let’s now begin to create a Pd patch as an introducto ry exercise. We will create
some objects and wire them together as a way to explore the interface.
Creating a canvas
A canvas is the name for the s hee t or window on w hich you place objects. You
can resize a canva s to make it as big as you like. When it is smaller than the
patch it contains, horizontal and vertical scrollbars will allow you to change the