beanz Magazine

Create Art and Music from Pure Data

Elvire.R. on Flickr

Show off your musical side with Pure Data!

We’ve talked about a lot of programming languages in this magazine, but I can say we’ve never covered anything like Pure Data.

Pure Data is a language for artists and musicians rather than programmers! Pure Data doesn’t even call its programs “programs” but rather patches after the term for configuring synthesizers to make a particular sound

A modular synth. The particular connection of wires controls the flow of electricity and is called “a patch”

To this end, Pure Data programs look more like

A Pure Data program that defines a musical instrument, in this case a snare drum

You’re connecting a bunch of gadgets with wires so the data can flow between them. It’s more like hooking up an electronic circuit than writing a program, but it’s absolutely still a programming language: just one that handles images, videos, and audio like Python handles text and numbers.

This means that Pure Data can be used to easily make weird music videos, create strange art out of pictures, or even create musical instruments that can be played from other programs like Sonic Pi—discussed elsewhere in this issue.

There’s a few things that we need to discuss to help you get started, though, so that you can start playing around making your own cool, strange, memelord art projects.

The first thing to note is that you can install it from the PureData site here and you’ll also want to install the Gem library as well using the built in package manager, which you can get to by going under Help>Find externals and searching for Gem.

Next, when you first run Pure Data you’ll see something like this

The very first thing you need to do is change the preferences to load up Gem every time PureData starts. Follow the screenshot below

And add Gem (capitalization is important!) to the list of libraries loaded on startup.
Now, restart Pure Data. You’re now ready to do all the examples in the rest of the article!
Next, we need to talk about how there’s really only four basic kinds of thing in Pure Data

  • Objects
  • Messages
  • Numbers
  • Symbols

The first are objects. Objects are the gadgets that actually do things in Pure Data. What kinds of things? Well, objects in Pure Data are

  • Variables
  • The dac that takes data and turns it into sound
  • The file explorer that allows you to choose a file to load
  • Sliders
  • Buttons
  • Arithmetic functions
  • &c.

Messages on the other hand are a way to send data to objects, like the way you give arguments to functions, except that in Pure Data you connect inputs and outputs with wires: starting by clicking on the output of one thing and dragging until you hit the input of another like this Hello World style program

This is two objects and a message. The first object you can make is the button you’re going to click, which you can get by selecting Object in the Put menu. You’ll get a little text box where you can type the name of the object, which in this case is bng for “bang”. Type this and then click out of the text field and the object will turn into a little button. Make another object with the name print, which you’ll notice only has one input and no outputs. Lastly, go into the Put menu again and make a message you can use to send something to be printed. I chose the message “fluffy chicken”.

Now, the last unintuitive thing in Pure Data is that in order to run your program you need to switch out of edit mode by hitting ctrl-e. Only then can you tap the button and see it print out your message.

So I already hinted that you can do interesting things with video and images and we’re
going to look at an example of it. The following program lets you;

  • click the create message to make a new window
  • click the button on the left to choose a file to play
  • move the slider on the top to rotate the cube
  • toggle button above auto $1 in order to start and stop the video

The video I picked, which is of the cat @thegoodcatboy on Twitter, meant that I got to watch this masterpiece of cinema wrapped around a cube

As you can see, it’s still a pretty small program that you can wire up in not terribly long! Try pausing it, rotating it, and see what else you can do. How would you learn what else to try? The last secret is that if you right click on anything and select help you will get elaborate help files that tell you all about how to do everything

Learn More

Tutorials on Pure Data

https://www.hellocatfood.com/?s=pure+data

Pure Data documentation

http://puredata.info/docs

Making a snare drum in Pure Data

https://www.youtube.com/watch?v=mfoh0ucl23

What is pure data?

https://en.wikipedia.org/wiki/Pure_Data

Visual programming tools

https://www.postscapes.com/iot-visual-programming-tools/

What is a visual programming language

https://en.wikipedia.org/wiki/Visual_programming_language

Introduction to Pure Data (video)

https://video.search.yahoo.com/yhs/search?fr=yhs-Lkry-SF01&hsimp=yhs-SF01&hspart=Lkry&p=Pure+Data#id=2&vid=dd9faa00504fbd43ea0100af8d17088d&action=click

Pure Data Beginner Tutorial

https://www.instructables.com/id/Beginner-Pure-Data-Tutorial-Basic-Synth/

Max Visual Programming Language

https://en.wikipedia.org/wiki/Max_%28software%29

Also In The June 2020 Issue

This online coding website makes it easy and fun to learn to code.

Got robots? Figuring out how to set them on a predefined course?

Looking for smart ways to make the most of your summer?

Computers would not exist without this number which has an interesting history.

Checkout how one school celebrated Pi Day with a helping of Raspberry Pi!

Aim for their Motherboard! This time we are talking about Computer Zombies!

Two satellites in identical orbits help measure the Earth with a unique plaque for future Earthlings.

Ever wonder if a computer could shake hands? It happens more than you would think!

Join us as we explore the weird history of Windows in computers!

Be wary of these password pitfalls that hackers love and learn how to keep your data secure!

Interesting stories about computer science, software programming, and technology for June 2020.