Introducing PureData

By Haig on March 19, 2019 — 6 mins read

I’ve been posting my experiments exploring sound/musical instrument design and prototyping, and it occurred to me that although my writing had focussed on the creative process and user experience of playing instruments, it would you the reader to have more context and explanations of the technical side to go beyond just embedding links throughout my posts. Today i’d like to introduce you to Pure Data, an amazingly deep yet seemingly-simple music and sound creation development environment. Here’s the official description on the puredata.info website:

Pure Data

Pure Data (Pd) is a visual signal programming language which makes it easy to construct programs to operate on signals. We are going to use it extensively in this textbook as a tool for sound design. The program is in active development and improving all the time. It is a free alternative to Max/MSP that many see as an improvement.

As I learn more about Pd I realize that it has a number of redeeming characteristics that make it incredibly resilient. Apart from MaxMSP and VVVV, Pure Data is uniquely visual the only piece of software that allows you to program your own applications using a visual flowchart-like graphical user interface. Pd is open-source and platform-agnostic – working consistently across Windows, Mac and Linux platforms (and yes, RaspberryPi!). Pure Data is also extremely extendible, you can install libraries (Externals) to add new capabilities and many people write their one libraries. Finally, Pure Data can be embedded into other frameworks and hardware, there’s a libpd library that is used for iOS, Android and OpenFrameworks application development.

Ultimately, Pd enables musicians, visual artists, performers, researchers, and developers to create software graphically without writing lines of code.

Pd can be used to process and generate sound, video, 2D/3D graphics, and interface sensors, input devices, and MIDI. Pd can easily work over local and remote networks to integrate wearable technology, motor systems, lighting rigs, and other equipment. It is suitable for learning basic multimedia processing and visual programming methods as well as for realizing complex systems for large-scale projects.

Here are some of the basic components of Pure Data:

Objects

In Pd we use a flowchart with lines connecting boxes together to build programs. We call these boxes objects. Stuff goes in, stuff comes out. For it to pass into or out of them, objects must have inlets or outlets. Inlets are at the top of an object box, outlets are at the bottom. Here is an object that has two inlets and one outlet. They are shown by small “tabs” on the edge of the object box.

Connections

The connections between objects are sometimes called cords or wires. They
are drawn in a straight line between the outlet of one object and the inlet of
another. It is okay for them to cross, but you should try to avoid this since it
makes the patch diagram harder to read.

Data

The stuff or data being processed comes in a few flavours: sound signals, and messages. Objects give clues about what kind of data they process by their name. For example, an object that adds together two sound signals looks like |+ ~|. The + means that this is an addition object, and the ∼ (tilde character) means that its object operates on audio signals.

Edit Mode

When you create a new object from the menu, Pd automatically enters edit mode, so if you just completed the instructions above you should currently be in edit mode. In this mode you can make connections between objects or delete objects and connections.

Wiring

Hovering over an outlet will change the mouse cursor to a new “wiring tool.” If you click and hold the mouse when the tool is active you will be able to drag a connection away from the object.

Bang Message

This is the most fundamental and smallest message. It just means “compute something.” Bangs cause most objects to output their current value or advance to their next state. Other messages have an implicit bang so they don’t need to be followed with a bang to make them work.

Float Messages

“Floats” is another name for numbers. As well as regular (integer) numbers like 1, 2, 3 and negative numbers like −10 we need numbers with decimal points like −198753.2 or 10.576 to accurately represent numerical data. These are called floating point numbers, because of the way computers represent the decimal point position.

Number Box

For float numbers we have already met the number box, which is a dual-purpose GUI element. Its function is to either display a number or allow you to input one. A bevelled top right corner like this denotes that this object is a number box. Numbers received on the inlet are displayed and passed directly to the outlet. To input a number click and hold the mouse over the value field and move the mouse up or down. You can also type in numbers. Click on a number box, type the number and hit RETURN.

Toggle box

Another object that works with floats is a toggle box. Like a checkbox on any standard GUI or web form, this has only two states, on or off. When clicked a cross appears in the box like this and it sends out a number 1; clicking again causes it to send out a number 0 and removes the cross so that it looks like this .

Sliders and Other Numerical GUI Elements

GUI elements for horizontal and vertical sliders can be used as input and display elements. Their default range is 0 to 127, nice for MIDI controllers, but like all other GUI objects this can be changed in their properties window. Unlike those found in some other GUI systems, Pd sliders do not have a step value.

Message Box

These are visual containers for user-definable messages. They can be used to input or store a message. The right edge of a message box is curved inwards like this , and it always has only one inlet and one outlet. They behave as GUI elements, so when you click a message box it sends its contents to the outlet. This action can also be triggered if the message box receives a bang message on its inlet.

Symbolic Messages

A symbol generally is a word or some text. A symbol can represent anything; it is the most basic textual message in Pure Data. Technically a symbol in Pd can contain any printable or nonprintable character. But most of the time you will only encounter symbols made out of letters, numbers, and some interpunctuation characters like a dash, dot, or underscore.

Lists

A list is an ordered collection of any things, floats, symbols, or pointers that are treated as one. Lists of floats might be used for building melody sequences or setting the time values for an envelope generator. Lists of symbols can be used to represent text data from a file or keyboard input.

Pointers

As in other programming languages, a pointer is the address of some other
piece of data. We can use them to build more complex data structures, such
as a pointer to a list of pointers to lists of floats and symbols.

Tables, Arrays, and Graphs

A table is sometimes used interchangeably with an array to mean a two-dimensional data structure. An array is one of the few invisible objects. Once declared it just exists in memory.

Posted in: Code, Music, Projects, Research

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.