Introduction to Pure Data

Sept. 23, 2010, 12:16 p.m.

This is a basic introduction to PD that was written for my technical writing class.  I reposted it here as a good overview of PD for those who have never used it.

Overview

When it comes to choosing a programming language, there are many choices.  For low level designs concerned with speed, assembly language or C could be the way to go.  For portable higher level designs involving graphics or games, an object oriented approach using Java might be more appropriate (1).  For a more specialized task, a more specialized language can be used.  Pure Data(PD) is a programming language tailored to real-time multimedia creation and processing.  PD specializes in audio processing, but also has libraries available for graphics and video.

History

Pure Data is an open source program that is developed and maintained by Miller Puckette.  PD was originally developed when puckett was working in France.  It is closely related to other specialized processing languages such as MAX/MSP(2).  Because PD is open source unlike it’s commercial cousin MAX, it can be downloaded, used, modified and redistributed freely.

Uses

Pure Data has many uses.  Its ability to combine many inputs, both digital and analog, and use them to control and manipulate one another is it’s greatest strength.  Pure Data can be used to create playable synthesizers, audio mixers, video mixers, sophisticated drum machines, samplers and more. A recent example of creative PD use would be the the RJDJ app available on the iPhone.  RJDJ uses PD patches to create generative soundscapes that react to microphone, touchscreen, GPS and accelerometer input.

PD basics

While most programming languages use text as their primary programming method, PD uses a graphical patching environment.  Each “patch” (program) is made up of a collection of objects.  The different objects are physically represented on the screen by a rectangle with inlets(on the top) and outlets(on the bottom).  Objects which create and process audio are denoted by using a “~” at the end of the object name.  You can create a series of objects and connect their inputs and outputs just like you would using physical hardware.  This makes PD very easy to understand for a musician with little programming experience who is interested in creating digital music.

A screenshot showing part of a Pure Data patch.

 

Each object is either an external(which can be programmed in C) or an abstraction(which is created by combining a group of other objects into a function based group).  This allows the user to combine simple objects into higher level objects like playable synthesizers with parameters.  After creating many higher level objects, it lets the user do things like composition and control on a higher level, while being able to get in and control each synth parameter and oscillator in detail.

PD Patching

Objects in PD are connected by virtual patch cables.  The thin cables transmit data, while the bolded cables transmit audio information.  Many objects, such as the audio multiplication object(“*~”) accept a mix of both audio and data signals(3).  The main design paradigm in PD is to manipulate outputs into the appropriate form for inputs.  For example, a MIDI slider or knob on a keyboard outputs an integer between 0-127.  To connect this to a synthesizer volume control that wants to see an input of 0-1, simply divide the output of the midi slider input by the number 127 before connecting to the input of  synth.

Connecting lines between all objects can result in a very messy and hard to understand program.  To solve this program, PD utilizes send(“s”) and receive(“r”) objects to send signals without actually connecting the lines between them.  Send and receive work only for data signals.  To send audio signals without connecting patch cables the “throw~” and “catch~” objects are used. Graphical User Interfaces After you’ve created an application, you want an easy way to control it.  PD comes with many built in graphical user interface(GUI) options.  There are horizontal and vertical sliders, buttons, checkboxes, X-Y pads and more.  Connecting these through different math functions to the inputs of objects can allow sophisticated control over all parameters.

 

A finished program using built-in PD GUI objects.

 

For more advanced GUIs, there are extensions such as GrIPD.  GrIPD allows you to create interfaces with custom graphics, images and control for a more custom look for your PD patches. PD Visuals There are a few libraries that allow PD to do visual processing.  The Graphics Environment for Multimedia(GEM) library allows PD patches to create openGL graphics.  There are many objects for creating and manipulating simple 3D shapes such as planes and spheres.  GEM can also use a webcam input to project onto the surface of the shapes in 3D.  By combining GEM with an existing audio patch and using the controls and input to manipulate one another, the programmer can create a very complex and interactive experience using simple pieces.

A PD A/V art installation using GEM to manipulate a webcam image in response to generated music.

 

Learning More

The best way to learn to use PD is to analyze the tutorial patches.  There are many tutorial patches covering a wide variety of PD features.  To learn more about a specific object, all you need to do is right click the object and select “Help”.  This opens up a help patch for each specific object.  In each help patch is a text description and often the patches often include many example setups that you can reuse as a starting point in your own patch. Now that you’ve seen Pure Data’s features, and gotten a feel for it’s basic concepts, you can evaluate it as a platform and tool for your next programming project.  

The latest updates to PD-extended(which includes many extra libraries) can be downloaded from http://puredata.info/downloads.

 

Works Cited

(1)Programming Languages. http://alternatives.rzero.com/lang.html (accessed Sept.15, 2010).

(2) Pure Data-PD Community Site Home Page. http://puredata.info/ (accessed Sept. 15, 2010). (3) Puckette, M. The Theory and Technique of Electronic Music. ;World Scientific Publishing Co: New Jersey, 2007.

  • Thanks! One of the most powerful ways to extend simple MIDI hardware is really simple using PD. The customized layers technique you talk about is completely underutilized outside of a small niche.
    jordancolburn - Aug. 23, 2011, 7:34 a.m.
  • Thanks, I extended my BCR2000 & some other hardware by using Bome Midi Translator and making what I call "virtual layers". Now it's time to use Pure Data to make at least GUI for that. Thank a lot for your work, inspired me. Krzysztof(Kris)
    Kris - Aug. 12, 2011, 4:18 a.m.