welcome to puredata.wikispaces.com

Pure Data WIKI

This page was set up by Edward Kelly to discuss issues relating to Pure Data (PD).
PD was created by Miller Puckette and many others have contributed to its development over the years.
The community site is at http://puredata.info

Learning Pure Data

Pure Data was originally created as a computer music dataflow programming environment, but it has been expanded and enhanced to include objects for manipulating video and 3D graphics, neural networks and a huge variety of sound and image analysis and creation tools. You can begin learning Pure Data techniques for any object or library of objects by searching the help files and examples from the help -> browser, but there are several online tutorials and books available.
  1. http://www.pd-tutorial.com/ is an online version of the book loadbang by Johannes Kreidler. It is concerned solely with sound synthesis techniques in Pure Data, but is a good place to start learning.
  2. Floss Manuals have a good beginners tutorial for Pure Data. You can find it at http://flossmanuals.net/puredata and it covers audio, dataflow and GEM (3D and video) programming for beginners.
  3. The manual to Pure Data (vanilla only) can be found at Miller Puckette's website here. Miller has also written a book, Theory and Techniques of Electronic Music - a comprehensive guide to computer music theory with applications in Pure Data.
  4. Dr Raphael Hernandez has an excellent series of tutorials for beginners on YouTube.
  5. I am developing a website of Pure Data tutorials: http://sharktracks.co.uk/puredata
    There is also a Vimeo site I am developing with video tutorials: http://vimeo.com/puredata

You can download the latest stable releases of PD at puredata.info/downloads Pd-Extended comes with all of the external libraries that are available for each operating system. Pure Data works on Windows, Linux and Macintosh operating systems.

GEM also comes with PD extended, and this is the 3D graphics library, but you can also do many things with video also using the pix_ objects. You can project movies, textures, color and lighting onto 3d objects, interact with particle generators, simulate elasticity (with PMPD), and import models made in Blender, Maya and 3DSMax (wavefront .obj files - a number of other software packages support this format). GEM works on Windows, Linux and Macintosh operating systems, so if you have a Windows machine it is the only way to work with video.

OpenCVstands for the Open Source Computer Vision Library. It has been ported to PD by Yves Degoyon and Lluis Gomez i Bigorda, and can be used to detect faces, corners, objects etc within a video frame (using either GEM or PDP).

There are a variety of people in the PD community who are working on VJ tools - the creators of Qeve - a VJ tool for Linux (e.g. Pure Dyne) are linked with the PDVJTools community. There is ongoing development of GEM at IEM in Austria: http://gem.iem.at

PD List

Pure Data is open source software, so it is developed and maintained by a global community of people. It makes sense to consult the community when you have questions or problems with your patches by joining the PD List. It is by far the quickest way to find answers and ideas about PD. All you need is an email account. I recommend you use a Gmail or Yahoo account - don't use your university account as you will lose all your emails when you leave. I have had all the PD list emails filtered into a folder on my Yahoo Mail account for seven years now, and I have found it very useful to swap ideas and ask questions of the Pd community.
There is also the Pure Data forum:

PD Workshops @ Camberwell

Every year I run a series of workshops about Pd for the MA Fine Art Digital course at Camberwell College of Art. Patches associated with this course can be downloaded here:

Dataflow, Audio, Analysis

metastudio-0.5 - my library of audio abstractions
audio_1.zip - some audio files for you to play with!

Add the Metastudio modules to your path from File -> Path (Windows/Linux) or Pure Data -> Services -> Path (Mac)

GEM, PDP, Video

Here are some video files to work with:

Pd + Arduino



CAM_ws_30102012.zip - Random Sound Event Generator
video_choose.zip - video player and chooser
video_choose_init_windows.zip - video player and chooser (Windows version)
ambience_generator.zip - randomly crossfades between ambience recordings

textRotateMove.zip - spinning moving text.
messages_19112012.zip - message examples from the 19th November 2012

investigate.pd - some objects you might investigate (regarding images and video) - remember to consider the real-time possibilities.
Cam_Imageselect.zip - an image selector in GEM, with several features

sound_tools_v1.zip - various sound manipulation tools that are relatively easy to use.

Assembling Arduino Projects

Arduino is an open-source hardware and software that you can use with sensors, motors, solenoids (electrical push-pull devices), lights and almost
any electrical or electronic device. You can interface the device with many software platforms, including Pure Data and Processing.
More information about arduino can be found on my page at http://arduinocamberwell.wikispaces.com and there is more information about the processing visual coding platform at http://processingcamberwell.wikispaces.com
When assembling arduino projects it pays to make prototypes with a breadboard. When using sensors, always look for a datasheet and if possible a schematic. The datasheet can be used to work out how to calibrate the input using resistors, or in terms of the arduino code. The latter may be a challenge, and you will have to learn to read an use the graphs in the datasheet. You can view a working example of how this done here: Arduino: Using A Sharp IR Sensor For Distance Calculation
Datasheets should be available from the suppliers website (see below).
On the other hand, the arduino platform, and the whole philosophy of open-source hardware has been so successful that there are a vast number of demonstrations and tutorials on the Internet. Youtube videos are a-plenty, and there are many other sites where you can access information in how to program and construct arduino projects.

Information about the Arduino boards: http://www.arduino.cc
There is also a wireless interface to the Arduino, called the XBee
The Arduino board is programmed using the arduino language which is based on Wiring, a language developed to program microcontrollers. There are several ways to use the Arduino with PD, and you can see a list of downloads and locations at http://www.arduino.cc/playground/Interfacing/PD. You will still need the arduino Integrated Development Environment (IDE) for uploading your arduino sketches to boards.

Arduino Users Websites

Arduino is a hardware platform for physical interfaces to the computer, and the Arduino community includes people using many software and hardware combinations as well as PD. Good advice on component use, circuit building and code can be found on arduino users project websites, as well as the main sites.
The primary site is http://www.arduino.cc, and on this site there are several branches:
Download the Arduino IDE. You will need this to program your boards.
Arduino Forum - where you can post your questions, and view questions, solutions and project ideas from other Arduino users.
Arduino Tutorial Homepage is where to go if you want to get to grips with the Arduino programming language. There are many code examples of arduino programming relating to different sensors, robotics, display etc.
Arduino Playground is full of projects, ideas and code contributed by the Arduino community.
Arduino Interfacing has a list and information about every language or software system Arduino can interface with and...
**Arduino Pure Data** is where you can find information about connecting Arduino boards to Pure Data.
Freeduino is another community-based arduino code repository.
Ladyada.net has many interesting projects and tutorials.
Luckylarry.co.uk has a lot of interesting material regarding arduino, and also processing.

A search on YouTube yields many results.

Programming the Arduino Board

The Arduino can be configured to accept a wide variety of digital and analogue inputs, and the boards can drive motors, solenoids and other electronic actuators. It's programming (Arduino sketch) needs to be uploaded every time it is plugged in, but you can plug in an external 9V power supply and disconnect it from the computer and it will continue to function. Obviously this works if you are creating a stand-alone Arduino sketch, but there are also interfaces suck as the XBee that you can use to connect the Arduino to a computer using a wireless interface (WIFI).

First download the Arduino software for your machine.
To use Hans Cristoph-Steiner's PDuino interface to PD load the file named Standard Firmata, as shown below:

A new sketch will pop up with the Standard Firmata code in it. If you hit the Upload button as shown below, the code will be checked and uploaded to the board (if it checks out - if it doesn't compile you will see red messages in the lower panel of the sketch).
You should see two orange LEDs on the board flash, and when they stops flashing your board is programmed. The arduino IDE will also tell you when the board is ready for use.


The PDuino interface gives you access to all of the functions of the standard firmata firmware for arduino:
external image arduino-test.pd.png

While this is useful for testing, it makes sense to strip the interface down to its basic components once you have determined what inputs and outputs your project will need.
The [arduino] object in the center of the patch is an abstraction - a patch that sits in the same folder as the master patch, and is used as though it were an object. Click on the [arduino] object and you will see the patch:
Save this in your project folder.
When you look at the arduino-test.pd patch from PDuino, you will see that the graphical interfaces to the [arduino] object all output messages that are sent to [arduino]. In fact, the [arduino] object is configured entirely using messages, and outputs from the object corresponding to inputs to the board are directed to Pd objects using [route analog digital] objects followed by [route 0] [route 1] etc.
[open 0( will open the connection to the arduino if it is on COM0 or the first USB connection. You can check which connection the arduino is on from the arduino IDE, from the Tools -> Serial menu. The order of the list of ports starts from 0 and enumerates up.
Digital pins on the arduino are set to input or output using [pinMode( messages - [pinMode 5 1( sets digital pin 5 to output mode, and pinMode 8 0( sets digital pin 8 to input mode.
Analog inputs are enabled using [analogIns $1( messages (with the analog input number substituted for $1).
This guide is based on PDuino 4, and the interface has changed somewhat in the more recent version. The basic principle of it is the same however, and you can always find out how the messages to [arduino] are formatted by clicking on subpatches - [pd subpatch] or right-clicking on the subpatches with graphical interfaces and selecting open.

Once you have discovered what messages you need to configure your arduino, you can simplify the patch to what you need. Here is a patch that uses four analog inputs as triggers for a random sound generator patch:

Each analog input (i.e. IR proximity sensor) generates a constant stream of values. In this case when the value goes above 0.12 the [> 0.12] object outputs a 1. When the output of this object [change]-s from a 0 to a 1, the 1 is [select]-ed and a [bang( message is sent via [send IR_1]. Elsewhere in the patch, a [receive IR_1] will be used to trigger a sound.
Notice the [mapping/resample 100] objects. These limit the speed of data throughput to 100ms. You will need to smooth this data if you want to use it to control audio signals. Check out the Camberwell_arduino patches above to find scaling and smoothing functions for Pd.

Sensors, Devices and Projects

There are many websites that offer sensor technology for sale, and here are some of the best.
http://www.skpang.co.uk/ is a great place to buy arduino and seeeduino boards, sensors and kits.
http://www.coolcomponents.co.uk is another great online shop, selling arduino related components, kits and boards.

http://www.sparkfun.com is a US site that sells a huge range of sensors, kits and related hardware.
http://makingthings.com is a US site selling sensor technology, with the widest array of sensors.
For a comprehensive list of specific Arduino selling sites - Arduino Buy at the main site.

Remember also that Maplin.co.uk CPC and RS Components are useful for electronics generally.
The cheapest sensor other than a homemade sensor is the piezo transducer from Maplin which can be used as a contact microphone, or to detect knocks.


Many electronic components require that you connect them with a pull-down resistor. Resistors are colour-coded to indicate their value, and the chart shown below will tell you what value the resistor is.
external image ResCode.GIF
Most often, if the device is resistive then it will be connected with an extra resistor between the analog measurement pin and the ground. The circuit diagram is shown below for a Force Sensitive Resistor (FSR) - the zig-zag lines are the resistor and the FSR.
external image fetch.php?hash=e1e382&w=184&h=334&media=http%3A%2F%2Fwww.ladyada.net%2Fimages%2Fsensors%2Ffsrpulldownsch.gif
You can change the sensitivity of the device by changing the value of the resistor that goes from the ANALOG voltage pin to ground (DGND), but don't make it too low (<2.2K) or your project won't work properly.
Using digital inputs as switches is easy. A switch is fundamentally just two pieces of metal that come into contact, so you can make switches out of any metallic objects connected to two wires. Using tinfoil and sponges it is possible to make switches, but other methods using this principle will work just as well.
Here, the switch S1 is connected to Digital input 3 (D3) but a resistor (typically 10K) is used to ground the circuit, otherwise it will not work.

Pure Data Art

A small collection of assorted projects on the web:
Tag Magic's Visual Circus: http://www.youtube.com/watch?v=WNl9NoTD1jM
Fugue Kronostruktur: http://www.youtube.com/watch?v=nBO-G0ALA2Y
Puredata VJ Patch: http://www.youtube.com/watch?v=iZ-r95dH7uc
Vivarium Interactif: http://www.youtube.com/watch?v=6-AUl-GK9zc
Polychroma: http://www.youtube.com/watch?v=zNFhaSN5xXo
Reactable: http://www.youtube.com/watch?v=sL033Dspq8I


Check out these Youtube Channels:

http://obiwannabe.co.uk/ - Andy Farnell has some great tutorials about creating sound FX in Pure Data
http://musa.poperbu.net/content/view/73/50/#mandril - Pure Data patches for video and graphics manipulation
http://www.katjaas.nl/home/home.html - Katja Vetta's homepage, with the Slice Jockey
http://www.katjaas.nl/puredata/puredata.html - A good set of links to various Pure Data projects you can download
http://www.ekran.org - Ben Bogart makes art using artificial neural networks to organize image streams
http://marcodonnarumma.com/ - Marco Donnarumma uses biometric sensors to control Pure Data performances
http://www.uni-weimar.de/medien/wiki/PDCON:Start - the most recent Pd Convention was held in Weimar / Berlin in 2011
http://tvestroy.danslchamp.org/ - TVestroy is (or was) a project that generates images and sound, where the signal creates both the image and the sound. Check out some performances and demos of this on Youtube: http://www.youtube.com/results?search_query=tvestroy WARNING: If you suffer from epilepsy do NOT visit this website.

http://estereotips.net/ is an artist-collective site run by Luca Carruba in Barcelona, with many interesting projects documented

Not Pure Data!

Here is the link to the website for my undergraduate course in processing: