Pure Data (Pd) is already a free, convenient tool for making synths, effects, and sequencers and other musical generators. But imagine stripping away all the things that tie it to a platform – UI, specific hardware support – so it will run just about anywhere, on anything, in any context.

That’s what libpd, a free, embeddable, open source (BSD) tool for making interactive music, does. Coders can take their favorite language and their favorite platform, and just plug in the power of Pd. They don’t even have to know almost anything about Pd – they can let an intrepid Pd patcher create the interactive sound effects and dynamic music for their game and just drop a patch into their assets.

One of the most powerful applications for this is the ability to add interactive music and sound to mobile apps, on iOS and Android, without writing and testing a bunch of custom DSP code. And that has enabled the use of libpd in apps as successful as Inception: The App. With music by Hans Zimmer and a custom “dream” experience created by RjDj, that app racked up millions of downloads in under a couple of months, and then, far from sitting idle on the app launch screen, went on to clock in over a century of user “dreamtime.”

Okay, so, you’re sold. You want to see what this thing can do, and maybe try it out, and you’re wondering where to start. So, here’s some good news: there’s a new site and a new book to get you going.

The site: libpd.cc

libpd has a new home on the Web, both in the form of a new GitHub repository to organize all the code and docs and samples, and a site that brings together a showcase of what the apps does and points you to where to learn more. The single destination is now hosted here by CDM:


I built that site, so please, if there’s anything you’d like to see or you’ve got your own work created with libpd, let me know about it.

Even just having selected a few key highlights of apps built with libpd, it’s impressive what people are already doing with this tool:

libpd Showcase

The book, and a chat with its author

A new book published by O’Reilly focuses on building mobile apps using libpd, for iOS and Android. (iPhone, iPod touch, Android phones and tablets, and yes, even that “new iPad” introduced yesterday are therefore all fair game.)

You can read a section of the book right here on CDM, for a taste of what’s in store:
How to Make a Music App for iOS, Free, with libpd: Exclusive Book Excerpt

It’s an exceptional, comprehensive look at development using libpd, covering iOS and Android, but also a complete look at the libpd API and how to use it. For Pd patchers just getting started with iOS and Android, it includes all of the basics of how to use libpd in your mobile development environment. For mobile developers new to Pd and patching, it makes clear how you’d communicate with Pd, so you can either dive into Pd yourself or properly interface with patches made by musicians, composers, and sound designers with whom you may be collaborating. It’s an ideal title for anyone interested in taking a game and giving it a more dynamic soundtrack – in sound effects, music or both – or for people building mobile musical instruments and effects, sonic toys, interactive albums, or, really, anything at all that involves sound or music. Since it walks you through the entire development experience, you can sit down with it in the course of a few evenings, and get a complete picture of how to integrate Pd with your development workflow.

Dr. Peter Brinkmann, the principal developer of libpd, is the author of the title. I asked Peter to explain a little bit about the book, who it’s for (hint: you!), and what’s in it (hint: stuff you want to read!) …

CDM: How did this book come about? And the book process really helped drive improvements to libpd, too?

Peter B.: Shawn Wallace, an editor at O’Reilly, contacted me last summer and asked whether I would be interested in writing a short book on libpd. I was interested, and so I talked to my [Google] manager (“No conflict — we all have time-consuming hobbies!”) as well as a couple of colleagues who had written books for O’Reilly. They made a token attempt to dissuade me, but it was clear that they had enjoyed writing their books, and they seemed quite proud of the result, too.

Once I had made up my mind to write a book, the next question was whether to self-publish or go with O’Reilly. Self-publishing is a viable option these days, but then I decided that I really wanted an animal on the cover. Besides, I had never written a book before, and having the support of O’Reilly’s editorial staff made the prospect seem less daunting.

The first draft was done in mid-November, but at that time it was basically science fiction because it presented libpd the way I wanted it to be, not the way it was at the time.

So, after the bulk of the writing was done, libpd needed to be revised so that it would actually be in agreement with the book. In particular, Rich Eakin and I rewrote the iOS components for better performance and usability. That delayed the book by a month or so, which turned out to be a great stroke of luck because that was when I discovered that Xcode 4.2 had changed the entire development model by introducing automatic reference counting, instantly rendering existing
texts obsolete. That included my chapter on iOS, and so I had to sit down and rewrite it.

After that, the rest happened rather quickly — getting reviews, revising the draft, going through the production process. O’Reilly’s toolchain is remarkably efficient, using asciidoc and docbook in a Subversion repository. The editorial staff is great, too. I’m amazed to see how quickly it all came together.

How did you approach writing the book?

For the first draft, I just imagined that I was teaching a class on libpd. When you’re lecturing in front of an audience, you don’t have time to polish every sentence; you just have to talk and maintain some sense of momentum. That approach helps a lot when facing a blank page. After that, it’s many, many rounds of revisions to eliminate weak or redundant sentences.

For the sample code, I picked one project that uses all major components of libpd. That provided a natural progression from idea to completion, while touching on all important points in their proper context. I’m basically providing running commentary on my thought process when making an app, including common mistakes and pitfalls. Like this, readers will know how to recognize and work around most problems.

Another trick is to write more than necessary. The first draft contained a lot of gratuitous editorializing. Those parts were never meant to make it into the finished text, but they were fun to write and they kept me going when I wasn’t quite sure what to write next.

Who it’s for?

The book explains how to patch for libpd, and how to write apps with libpd, with special emphasis on the interface between Pd patches and application code. It’s for mobile developers who want to add real-time audio synthesis to their projects, as well as sound designers who want to deploy their work on mobile devices. It’s light on prerequisites; if you know how to write a basic app for Android or iOS, you’re ready to read the book.

Ed.: I’d add to that, given that there are such great tutorials on app development for Android and iOS – even many of them free, including some very worthwhile documentation from Google and Apple — if you’ve messed with Pd, you should give the book a try. And if you haven’t messed with Pd, this could be a great excuse. This book won’t teach you Pd, but it’ll make very clear how to glue everything together. -PK

Why does a book like this matter? What do you hope will come out of it?

I hope that the book will help popularize real-time procedural audio, in games and other apps. I’m thrilled to see all the projects that use libpd, and I hope that the book will help people create even more awesomeness of this kind. One thing I only fully realized when writing the book is that libpd lets developers use DSP code like a media file: An audio developer creates a Pd patch, and the app developer just drops it into the resources of the app and loads and
triggers it as needed. I guess this was implicit in a blog post I wrote on workflow and prototyping a year ago, but I think the DSP-as-media angle is even more powerful. I hope that the book will bring this out.

The book project has already improved libpd. Whenever I faced the choice between fixing an awkward bit of code or explaining the awkwardness in the book, I chose to fix the code. That took care of all the little things that were sort of bothering me but didn’t seem significant enough to spend time on. It also gave us a deadline for a number of related things that we wanted to do, such as migrating to GitHub and launching the new website, libpd.cc. Ed.: Cough. Yes, glad that gave me that deadline – and thanks to Peter B. for the extra push! -PK

Congrats to Peter on his first animal-on-a-cover! It’s really a great book: you read it, and feel like making more new things, inventing new creations that produce sound and music. And that’s a very good thing.

  • http://elburz.ca/ Elburz Sorkhabi

    That looks awesome! Definitely going to pick it up! Is there anything similar for the MaxMSP world (to libpd, that is)? Did a quick google, didn’t find much, might have been looking in the wrong direction. 

    • http://pkirn.com/ Peter Kirn

      Not now. Because Max/MSP isn’t open source software, it would be up to Cycling ’74 to create a runtime that can be distributed in third-party mobile applications. They do have such a runtime for desktop Mac and Windows, but not for other operating systems supported by Pd (Android, iOS, Linux), and it’s not embeddable in the same way inside another app.

    • http://pkirn.com/ Peter Kirn

      If you’re familiar with Max/MSP, though, you can probably contend with Pd.

    • http://elburz.ca/ Elburz Sorkhabi

      Ah, that’s a bit of shame that you can’t use Max freely on mobile devices (or even linux, would be awesome to run a whole Max controlled DMX show off a Raspberry Pi!). Been using Max heavily for a bit, hoping it shouldn’t be too hard to figure out pd. Glad to see theres a digital version of the book as well…phew!

  • http://sethsandler.com/blog Seth Sandler

    Awesome! This is great to see that libpd has a new home! 😀

  • http://www.federicopepe.com Federico

    I’m really looking forward to learning this kind of things. I was oriented to Max/MSP because I thought it was more complete but as, you said, isn’t embeddable inside iOS or Android. Now I don’t know if it is worth to pay $400 for a license when I can get PD for free. Maybe it’d be useful a comparative (and up-to-date) post/guide on these softwares (and DAW as well).

    • http://pkirn.com/ Peter Kirn

      Heh, well, it wouldn’t be a whole lot of a comparison – in either direction. If your primary target is Ableton Live, for instance, you’d choose Max. If you’ve got the $ for the license handy and you want to create something that’ll just run on a computer, you’d probably again choose Max. If you don’t have the money, you’ll choose Pd. If you want to build something that runs on mobile or Linux, you’ll choose Pd. And the bottom line is, even if you’re a Max user, there’s really no harm in downloading Pd. They’re each pretty excellent for a set of use cases, and those cases often don’t overlap.

      Honestly, I think the only real pitfall on the Pd side is that an ugly UI might scare you away from a tool even when it is the right choice for a job. In that event, I really recommend:

      They’re worth a look even if you’re a hard-core Max user; you’ll still pick up something you can probably use.

      You know, it’s easy to get hung up on the difference between the two tools. In the end, they’re each supported in large part by volunteer efforts, not just paid efforts, and they’re each labors of love, and they’re built by two communities that are pretty well connected with one another. One takes advantage of some of the possibilities of a proprietary, commercial model, and the other exploits what you can do with a free software model. 

      With either one, I think it’s worth giving the tool some time to appreciate what it’s for rather than forming a snap judgment. But that said, it’s also worth grabbing Pd and forcing yourself to pick a simple task and make something that you can use in your music – without getting overly ambitious (which is likely to lead to frustration), just focusing on a musical application. That’s a superb starting point for either option.

    • http://www.federicopepe.com Federico

      I hope to meet you someday. I owe you a beer.

  • Sasze

    Write a program for me to control sound with touch and I will pay $500. e mail sasze hot mail

  • wmsound

    SO cool. I’ve patched with Pd, so this is another notch to the belt with the idea of potential work in the future. I’ve been interested in the development of this since day one, but felt I would be talking nonsense to people until there was some kind of show case of its abilities. Great new web site btw.

    My question is – how do we get the app developers to recognise LibPD as a viable option? 

    ps. is this a new commenting system, I can’t seem to post as my profile….maybe I’m being a numpty