Pure Data Play, Friday 2nd November

On Friday 2nd November from 12pm I’ll be running a Pure Data workshop as part of Flip Festival at Lighthouse Media Centre in Wolverhampton.

pd

Pure Data is a dataflow programming language that is utilised for a wide variety of purposes including making generative electronic music, creating glitch visuals, interactive live performance and VJing (Video Jockeying). I’ll guide participants through the basics of Pure Data – including general usage, playing and manipulating videos and creating generative visuals that respond to different inputs. No experience of Pure Data is necessary, only a laptop and a willingness to experiment and learn!

The event is free to Flip Festival ticket holders and £6 for everyone else. Tickets can be purchased online. Here’s the event details on Facebook. Don’t forget to bring your laptop!

To see what can be created with Pure Data take a look at what I’ve made in the past.

Create jpgs in Pure Data

For Some of My Favourite Songs I utilised Pure Data Extended (I’m using a beta version) to read the audio files and then save them as images. Pure Data is usually used for the production of music and/or generative live visuals, so to using it to produce jpg images from almost nothing, or random data input is quite new to me!

In search of a jpg header

The most important part of this process is knowing how to construct and apply a jpg header to data. Wikipedia informed me that all jpg images begin with FF D8. I thought that all I would need to do is use a hex editor, such as Ghex or Bless Hex Editor, to add those byte values to a file.

Unfortunately this is not the case at all. There’s so much more in a jpg header, such as Huffman Tables, Quantization Tables, bytes to define the width and height of an image, and much more that I still don’t quite understand.

I attempted to grab data from the beginning of a random jpg file, but this included lots of extraneous data such as camera make, program(s) used to modify the photo, gps data and creation date. This data amounted to several kilobytes, which is far too much data for a header. What I needed was a “vanilla” or plain header that I could apply to any file.

mesmeon showed me the HEADer REMIX project by Ted Davis. The header values on the left of the screen are used for glitching every image, be it the default image or one taken by a user.

I saved the default image, manually extracted the header image, ran it through exiftool and then ended up with a header for a 640×480 image that is only 588 bytes!

Enter Pure Data

Now that I had a vanilla header I had to devise a way to use it in Pure Data. The [binfile] object allows the reading and writing of binary data. Adding data to [binfile] is a case of sending a message containing numbers to the object.

[binfile] reads and outputs data as decimal values i.e. numbers from 0 to 255. I needed to find a way to add the decimal values of the vanilla header to a message box. Martin Meredith helped me with this whilst we were tackling bugs at the Ubuntu Global Jam. Using hexdump I was able to output all of the hex values to decimal values.

[bash]hexdump -v -e ‘1/1 "%02u "’ filename.here > decimalvalues.txt[/bash]

[bash toolbar=”true”]255 216 255 219 00 132 00 03 02 02 03 02 02 03 03 03 03 04 03 03 04 05 08 05 05 04 04 05 10 07 07 06 08 12 10 12 12 11 10 11 11 13 14 18 16 13 14 17 14 11 11 16 22 16 17 19 20 21 21 21 12 15 23 24 22 20 24 18 20 21 20 01 03 04 04 05 04 05 09 05 05 09 20 13 11 13 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 255 192 00 17 08 01 224 02 128 03 01 17 00 02 17 01 03 17 01 255 196 01 162 00 00 01 05 01 01 01 01 01 01 00 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 10 11 16 00 02 01 03 03 02 04 03 05 05 04 04 00 00 01 125 01 02 03 00 04 17 05 18 33 49 65 06 19 81 97 07 34 113 20 50 129 145 161 08 35 66 177 193 21 82 209 240 36 51 98 114 130 09 10 22 23 24 25 26 37 38 39 40 41 42 52 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104 105 106 115 116 117 118 119 120 121 122 131 132 133 134 135 136 137 138 146 147 148 149 150 151 152 153 154 162 163 164 165 166 167 168 169 170 178 179 180 181 182 183 184 185 186 194 195 196 197 198 199 200 201 202 210 211 212 213 214 215 216 217 218 225 226 227 228 229 230 231 232 233 234 241 242 243 244 245 246 247 248 249 250 01 00 03 01 01 01 01 01 01 01 01 01 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 10 11 17 00 02 01 02 04 04 03 04 07 05 04 04 00 01 02 119 00 01 02 03 17 04 05 33 49 06 18 65 81 07 97 113 19 34 50 129 08 20 66 145 161 177 193 09 35 51 82 240 21 98 114 209 10 22 36 52 225 37 241 23 24 25 26 38 39 40 41 42 53 54 55 56 57 58 67 68 69 70 71 72 73 74 83 84 85 86 87 88 89 90 99 100 101 102 103 104 105 106 115 116 117 118 119 120 121 122 130 131 132 133 134 135 136 137 138 146 147 148 149 150 151 152 153 154 162 163 164 165 166 167 168 169 170 178 179 180 181 182 183 184 185 186 194 195 196 197 198 199 200 201 202 210 211 212 213 214 215 216 217 218 226 227 228 229 230 231 232 233 234 242 243 244 245 246 247 248 249 250 255 218 00 12 03 01 00 02 17 03 17 00 63[/bash]

(The output is sent to a text file for ease of copy/pasting)

With this output I copy/pasted the values into a message box, and whenever I needed to add a jpg header to a file I clicked on the message box! To then write the file I sent the message [write filename.jpg( to the [binfile] object.

A jpg header in Pure Data

Using this data alone you may notice that the jpg image doesn’t open in certain image viewers or is blank/black. That is because all that was added is the header. Image data is also needed! For this I added a few [metro]s to generate random numbers between 0-255. The output image then looks a little bit more colourful now.

jpg created by Pure Data

For some websites and image viewers the End Of Image bytes (FF D9/255 217) need to be added in order for it to be viewed properly. To start this process again send [clear( to [binfile]. This clears all binary data. Below is all of this theory put into one patch.

The finished Pure Data patch

Pure Data [binfile]

Generate jpg images – click to download

To use it, first click on the button to start the jpg file, then click the toggle button to add lots of random data. This may take a minute or so. Once done turn off the toggle, click on the button to end the file and then write the jpg image.

Further options

If you know the structure of a certain file type, in theory, it is possible to construct one in a similar way to this. I’ve already used this method to construct a bmp, but they produce far less interesting results. png files seem to be more fragile and, as such, I haven’t managed to create one using this method.

If you use a second [binfile] object you can load the bytes from another file and use them, in conjunction with random data, to produce glitchy – but slightly recognisable – images!

Is it also possible to reduce the size of the jpg header even further?

Create jpgs in SuperCollider

Holger Ballweg (uiae) has recreated this progress in SuperCollider. Check it out!

From Digbeth With Hammers at BOYD 8

Since November 2011 I’ve been providing visuals for First Fold Records’ monthly Bring Out Your Dead (BOYD) events. This sees me working with the headline acts to create visuals tailored to their performance. I often do a recording of the sets, which you can see on my YouTube channel.

For BOYD 8 I did visuals for local band From Digbeth With Hammers. The band said they wanted any visuals that included “bricks and concrete and things that look like they’ve been hit with massive hammers.” So, I got them lots of videos of explosions, demolition sites and cranes 😉 Here’s a sample of the visuals that I did set to the “Collage” track available from their website

Their set on the night was much louder than this track and was overall really awesome. That night also saw me try out a few new techniques in Pure data.

From Digbeth With Hammers for BOYD 8

In addition to using the [newWave] object as my plane for displaying videos I utilised feedback loops and the red/green 3D display mode (made by sending [stereo 3( to [gemwin]).

From Digbeth With Hammers

Old-school 3D!

Perhaps the biggest change was my use of the keyboard for controlling visuals. The mouse is a great input device but it doesn’t lend itself to rapid responsiveness. In past performances I’ve often found myself reacting to the visuals a second later due to having to scroll my mouse over the patch to find the right button to press. Being able to press a key is so much quicker!

The next BOYD night is on 7th June

Making Skin Cells

The making of Skin Cells was quite a long process. It started projecting my Bunnies video onto me and filming this. I then took this and ran it through the What Glitch? sgi script to create a glitched version of the video, leaving me with two versions of the video.

Skin Cells

Skin Cells

When it came to merging the two videos together I took some inspiration from Tidepool by Tabor Robak. Putting the videos on top of each other I wanted to use chromakeying to reveal parts of the video at the bottom at the same time as really oversaturating the video. For this I employed the help of Pure Data:

Skin Cells Pure Data patch

By using [pix_chroma_key] and setting the [range( to random values the patch was constantly hiding and revealing random parts of the videos. Some wizardry in Gridflow gave the videos that oversaturated look.

If you want to try this patch for yourself go ahead and download it. Although it may work on other setups, I used the following:

To use the patch, first load a directory of videos, create the GEM window and then press the big red start button. A video is automatically saved (using PDP), though do be careful as these files get very large very quickly! If, for any reason, saving the video doesn’t work just delete the line going from [#from_pix, colorspace rgb] to [#to_pdp].

If any assistance is required please direct your attention to this thread on the Pure Data forum.

GLI.TC/H 2011 – This website does not supply identity information

My bumper for GLI.TC/H 2011. Download the Pure Data patch that made this and make your own!

Discuss it with others on the Pure Data forum.

.our_name/website {
GLI.TC/H
gli.tc/h
}
.theDates {
Chicago_USA: Nov 4-6 2011;
Amsterdam_NL: Nov 11-12 2011;
Birmingham_UK: Nov 19 2011;
}

I’ve also recently started making diagrams of my Pure Data patches. I hope they go some way to helping people learn Pure Data

GLI.TC/H bumper Pure Data patch

Pretty pictures

The face game

I’m working on a live performance that in some ways will incorporate glitch and perhaps animation. This is one step towards getting a finished performance down, but also a bit of fun.