Managing Audio with Pd
Pure Data (Pd) is a real-time visual programming environment for audio and other multimedia applications. With it you can make patches that perform operations on audio and visual data. These patches are represented visually; you “draw” where you want the signal data to go and what you want to happen to it. This process is similar to how you program modular analog synthesizers. The process also is well suited to how you end up programming sound and video applications; signals come in and go out, and you manipulate various signals along the way. Due to space constraints, this article covers only the more mature audio capabilities of Pd. If you later want to try the video processing plugins, you should find that many of the concepts are similar to those for audio.
Pd uses two main types of data, messages and audio signals. Messages are sporadic, like MIDI note events. They can contain numbers or strings and are used to pass around information, such as “set the gain on the output to x”. Audio signals are constant; whenever the DSP code is turned on, audio is being transferred. Internally in Pd, audio is represented by 32-bit floating-point numbers. This means that unlike conventional analog or digital sound processing, Pd signals can have nearly any amplitude you want. During processing you can make a audio signal really quiet for one stage and amplify it for another, with no loss in quality. Of course, when the signal is sent to a hardware output, you must make sure it's within the usable range of –1 to 1, or the audio gets clipped.
These messages and audio signals are manipulated by various types of boxes, described below. When put together, this collection of connected boxes is called a patch.
Boxes do all the work. Pd has four main types of boxes: object, message, GUI and comment. These boxes perform operations on messages and audio, provide ways to give user input and document what's been done. Object boxes in turn are divided into two types, control objects and tilde objects. Control objects work with messages and therefore perform their functions sporadically. Tilde objects work with audio data and perform their functions constantly.

Figure 1. An Object Box
Message boxes send their contents to their output port when the user clicks on them or when they receive a message on their input.

Figure 2. A Message Box
GUI simply refers to boxes you can interact with, such as the number box on the left.

Figure 3. A GUI Box
Finally, comments allow you to put text into a patch. They actually don't affect anything.

Figure 4. A Comment Box
Assuming you've compiled and installed Pd by now, you should try to start it. First, make sure you've set the setuid bit on the Pd executable, and make sure it's owned by root. Although this could be a security risk, you need to do this to enable real-time scheduling if you want to run Pd as any user other than root. If you don't and real-time scheduling isn't activated, you'll hear a lot of clicks and pops whenever any other process, even the X server, tries to do anything.
Run Pd with the -rt option and any other options you need in your setup. I'd recommend using -verbose, because Pd itself is not overly chatty and the verbose option does provide some useful information. When that's done you should see a window similar to the one shown in Figure 5. The IN and OUT boxes are peak meters for input and output, respectively, and can be enabled by clicking the peak meters option. If either clips, the respective CLIP box will go red. The DIO errors button flashes if there are any synchronization errors in the input or output. Click on it to see a list of recent errors. Finally, the compute audio check box turns audio processing on or off.

Figure 5. The Main Window
First, let's create a new blank patch in which to work (File→New). From this we are going to create a simple patch to print “Hello World!” to standard output. So, we need a message box to hold the message “Hello World!” and an object box to do the printing. Both of these can be created from the Put menu. You also can use the accelerator keys: Crtl-1 to place the object box and Crtl-2 to place the message box. Once you've done that, to enter the right text in the boxes, click on them and type. You also need to connect the outlet port on the bottom of the message box to the inlet port on the top of the object box. Your patch should look like the one shown in Figure 6. Get out of edit mode by pressing Crtl-E. Now try clicking on the “Hello World!” message box; if all goes well, a message saying so is printed to the terminal in which you started Pd.

Figure 6. The Standard “Hello World!” Example
The Magazine
Linux Journal is the premier source for how-tos, projects, product reviews, expert advice and opinions for everything Linux.
| Clonezilla Live | Sep 03, 2010 |
| No Steam for Linux - Right Now | Sep 02, 2010 |
| Qt and Layouts | Sep 02, 2010 |
| As Predicted, OpenSolaris Board Disbands | Sep 01, 2010 |
| Dual Boot openSUSE USB Stick Installer | Sep 01, 2010 |
| New Wine: Running Windows Music & Sound Applications Under Wine 1.2 | Aug 31, 2010 |
- Boot with GRUB
- New Wine: Running Windows Music & Sound Applications Under Wine 1.2
- Clonezilla Live
- Chapter 16: Ubuntu and Your iPod
- Monitoring Hard Disks with SMART
- As Predicted, OpenSolaris Board Disbands
- Validate an E-Mail Address with PHP, the Right Way
- Building a Home File Server
- No Steam for Linux - Right Now
- Qt and Layouts
- Solaris 10 changed something on my Dell Studio Hybrid 140G's HD
11 min 59 sec ago - Typing Error Correction (2)
22 min 35 sec ago - The new season again come, no
1 hour 9 min ago - very goood shopping
1 hour 9 min ago - very goood shopping
1 hour 10 min ago - lkaufoiw
1 hour 37 min ago - lkaufoiw
1 hour 41 min ago - It has some usb
6 hours 17 min ago - How can I get source for
7 hours 58 min ago - MEPIS
12 hours 1 min ago












Comments
Post new comment