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
To this end, Pure Data programs look more like
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
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
- The dac that takes data and turns it into sound
- The file explorer that allows you to choose a file to load
- Arithmetic functions
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
Tutorials on Pure Data
Pure Data documentation
Making a snare drum in Pure Data
What is pure data?
Visual programming tools
What is a visual programming language
Introduction to Pure Data (video)
Pure Data Beginner Tutorial
Max Visual Programming Language
Also In The June 2020 Issue
Time to grab your favourite good luck charm and get ready for some high-stakes coding!
Thinking about participating in a Game Jam? Here's some helpful tips and tricks!
Find out how to blend the physical and digital worlds with a Makey Makey Circuit board!
This online coding website makes it easy and fun to learn to code.
Become a coding musician with Sonic Pi!
Got robots? Figuring out how to set them on a predefined course?
In the pandemic, online gaming has become a force for good for kids.
Looking for smart ways to make the most of your summer?
Computers would not exist without this number which has an interesting history.
Show off your musical side with Pure Data!
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!
Links from all the stories in this June 2020 issue of the magazine!
Interesting stories about computer science, software programming, and technology for June 2020.