4.6. Physical Computation with Pure Data

This section is an introduction to physical computing using dataflow programming. This style expresses computation as a graph in which data messages flow over connections between objects which act on the data. We will be using the open-source real-time Pure Data (Pd) visual programming language, which stems from the same work as the commercial Max/MSP system.

Dataflow languages lend themselves well to expressing parallelism, event-driven actions, interactive and incremental programming, and real-time operation. Pd presents the program as a visual graph which follows a visual analogy of graphical modules that intake and process data and pass it along to other modules. Pd programs can be edited as they are running by making and breaking connections, editing parameters, and adding new operators. Pd includes many GUI objects so that controls can be embedded directly in the program.

4.6.1. Takeaway Lessons

Pure Data offers tremendous flexibility: in one environment you can work with physical computing, audio analysis and synthesis, video analysis and synthesis, and more. Pure Data is free and open source, and it works on personal computers (Windows, OS X, Linux), smart phones (iOS, Android), embedded platforms (Raspberry Pi, Udoo, BeagleBone).

Pure Data is good at: rapid prototyping of interactive audio/visual systems, controlling multiple parallel processes with complex timing; audio analysis and synthesi.

Pure Data is bad at: recursive programming, general graphical user interfaces, integration of documentation, adhering to computer science conventions for naming. The Pd third-party libraries in particular are quirky and poorly documented, but many, many features are available.

Pure Data is very extensible: you can extend Pure Data’s functionality with C/C++, Python or a range of other text-based programming languages. Pd has a simple API for compiling binary extensions which can be dynamically loaded into a Pd program and operate like native Pd objects.

Pd programs are called patches. Pd patches can instantiate multiple copies of other patches and treat them as a single object; these other patches are then called abstractions. This is the primary means for creating re-usable modules and subroutines. Patches can also incorporate internal subgraphs called subpatches which exist in only one copy, but allow for organizing a hierarchy of code within a single file.

Pd abstractions implementing GUIs often use a graph-on-parent mode which allows a region of the abstraction patch to be visible in the parent patch. This is typically used to provide GUI control objects within a panel.

4.6.3. Project Idea: Dream Machine

A suggested PureData project is inspired by the Dreamachine, “a stroboscopic flicker device that produces visual stimuli.” Artist Brion Gysin and William S. Burroughs‘s “systems adviser” Ian Sommerville created the dreamachine after reading William Grey Walter‘s book, The Living Brain.

The goal is to make an enchanted object that uses sound, light and movement to create a dream-like state for the viewer. These machines can be simultaneously performed for a coordinated, collaborative, dream experience. This is a very open-ended assignment: results may include pure-software sound synthesis, physical artifacts which create sound or light, physical interfaces for allowing performers to interact with the system.

This project will familiarize you with processes you have already explored with micro-controllers, but now with a personal computer or Raspberry Pi. They will also familiarize you with the work flow for using Pure Data on a laptop to communicate with a micro-controller, as well as Pure Data on a Raspberry Pi.