dark mode light mode Search Menu
Search

Geeking Out with PureData Music

jeanbaptisteparis on Flickr

If playing the piano isn’t geeky enough for you, let me introduce you to PureData (Pd for short). Pd is an open-source visual programming language that lets you create musical systems. It’s great if you like the idea of making your own synthesizer, or one that plays itself, or a system that generates infinite melodies and drum beats.

In this article, I’ll show how to set up Pd. Then demonstrate how to make a simple oscillator, the basic component of a synthesizer, with pitch and volume control. We’ll make sounds!

The first step is to visit the Pd downloads page at https://puredata.info/downloads/pure-data. Click the Download link for your computer operating system. First, click on the Pd link in the top left of the app, then click Settings to display the Preferences popup (A). On Windows, click File > Preferences > Edit Preferences. Confirm the input and output devices are set to your speakers or microphones. For now, we won’t use a microphone. I’ve selected my Mac’s built-in speakers.

A

When starting the Pd app, another window should appear. It’s called the log window (B).

The log tells us if something’s gone wrong with our Pd patches. If something doesn’t work when experimenting with a patch, check the log window for any errors. The log window also toggles on or off Pd’s connection to our main audio output. If the DSP checkbox at the top right of the log window is selected, Pd will be able to make sounds. Of course, you’ve got to patch something up first…so let’s do that now.

B

In Pd, a patch is a graphical data structure that defines objects that together make sounds. The first step in creating a Pd patch is opening a blank canvas. Type cmd+N (Mac) or ctrl+N (Windows), or by clicking the File link at the top left of the Pd app and then clicking the New link (C)

We should see a little window popup, named Untitled by default. This is our blank canvas, and where things start happening (D).

The first thing to do is to place an output~ object on our canvas. That’s output tilde. When we connect sound sources to this object, we will hear them.

To do this, first go into edit mode to change what’s on the blank canvas. To toggle edit mode on or off, press cmd + E (Mac) or ctrl + E (Windows). Once in edit mode, place Pd boxes on the canvas by pressing cmd + 1 (Mac) or ctrl + 1 (Windows). Or click the Put link at the top left of the app and click Object (E).

The Put dropdown menu lets you place visual objects or Pd boxes on the canvas. For today’s patch, we’re only using two different kinds of Pd objects, output~ and osc~.

When an object is placed down on the canvas, a box with dotted lines indicates the object is on the canvas. However, the object type is undefined. Because we’re making an output object, type output~ into the top left of the box (F). If you’re wondering why there’s a ~ (tilde) at the end of output, it’s because the ~ signifies the involvement of sound. A tilde also looks like a sound wave. Once you type output~ and click outside the box, the output object is created.

Of course, you shouldn’t hear anything yet because nothing is plugged into the output. Let’s change that by introducing a simple sine wave oscillator into the patch. The sine wave oscillator is an object, so pick a spot on the canvas, put in another object by typing cmd + 1 (Mac) or ctrl + 1 (Windows). This time, type in osc~ in the box (G).

Nothing’s still happening. While we’ve introduced a new object, they are not joined up. Almost all Pd boxes have inlets and outlets. Inlets receive data, and outlets send data. Below, the inlets are circled in blue and the outlets are circled in red (H). Outlets are always on the bottom of Pd boxes. Inlets are always on the top of boxes.

We use lines to connect these Pd boxes. To connect our oscillator to the output, click the oscillator’s osc~ outlet, and drag it to either inlet on the output~ object (I). Connecting to the left inlet of the output would send our oscillator’s sound to the left speaker while connecting to the right would send sound to the right speaker. Connecting both sends sound to both speakers.

Our oscillator object is connected, but no frequency value is specified for it. We’ve got to tell our oscillator to run at an audible frequency. Human ears can detect audio frequencies from about 20 Hz to 20,000 Hz, or 20 kHz. So, let’s tell the oscillator osc~ object to run at 440 Hz, which is an A in musical notation. Type cmd + E (Mac) or ctrl + E (Windows) to enter edit mode, click on the oscillator object, add a space after the osc~ and then type the desired frequency (J). It should look like osc~ 440.

The thin black vertical line at the middle left of the oscillator is a volume slider. With edit mode disabled, click and drag the line right or left to change the volume. When the volume slider is turned up, you should hear a tone. If you still don’t hear anything, make sure the DSP box is checked in the log window, located at the top right of the window, and that your speaker volume is turned up.

To give a flavor of what’s next, let’s introduce a way to quickly control the frequency of our oscillator. We’ll do this by adding in a slider. Add sliders to your PD project by going to the Put dropdown menu and selecting Hslider there (K), or you can use the shortcut Shift + cmd + J (Mac) or Shift + ctrl + J (Windows).

If you connect the slider to the oscillator osc~ object, the value as dictated by the slider overrides the 440 argument we specified earlier (L).

To alter the range of the values given by the slider, right-click on the slider and select Properties. Here, you can change the size of the slider, its color, and, most importantly, the upper and lower ranges of its output. By default, it is set from 1 to 127 (M).

Experiment with different output ranges, and see how high or low you can make your oscillator go. For starters, try 220 to 880. Once you’ve got a range you like, you can freely slide up and down the pitch of your oscillator.

M

Try selecting the whole patch by dragging along what you’ve made prior, then copy by pressing cmd+c (Mac) or ctrl + c (Windows). When you hit cmd+v (Mac) or ctrl + v (Windows), you’ve duplicated your patch. This means that you can have two or more oscillators to play around with. You can now go on to experiment with harmonies.

Learn More

What is Pure Data

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

Pure Data

https://archive.flossmanuals.net/pure-data/

8 DIY Synthesizers You Can Build at Home

https://thevinylfactory.com/features/8-diy-analogue-synthesizers-you-can-build-at-home/

Beginner Pure Data Tutorial

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

Pure Data

https://kidscodecs.com/pure-data/

Related Posts