Percussa micro super signal processor

Google’s Android has been a relatively slow starter for mobile music software, but a gem like Adam Smith’s free Ethereal Dialpad proves it’s a viable option, and the app is an inspiring musical toy, to boot. Perhaps more important than that, behind the scenes, Adam is employing a really beautifully audio engine of his own design with an elegant approach to coding sound.

Ethereal Dialpad features a set of basic modules for using touch to produce synthesized sound with real-time effects. The concept isn’t new – Adam says he was inspired by the pitch mapping on KORG’s Kaossilator – but it’s nicely executed, and the software is fun and responsive. I’ve tested it with some non-musician Android owners, and they were simply delighted. And yes, you can plug it into external effects and go absolutely wild – see the video below for one example.

Of course, these sorts of applications are relative commonplace on the iPhone, but few and far between on Android. So it seemed the perfect time to ask Adam to share his thoughts on developing for the platform.

Along the way, Adam has some great thoughts on live coding and sharing in the development community that go well beyond any one platform.

Mobile applications in general have often been self-contained, limited-lifespan creations; the simpler ones are almost like bubblegum – suck out the sugar and move on. But by sharing code, these simpler applications can have a greater life, as they’re extended and incorporated into other projects. That could suggest greater longevity over time for unusual interactive musical software creations in general. And with this application fitting into just 35K – yes, amazingly, even with all the packaged Android assets and Java code – the emerging landscape could even begin to resemble the demoscene of old.

Adam writes with some of the behind-the-scenes details of coding audio on Android:

The whole Ethereal Dialpad project started as an experiment with the AudioTrack api in the Android framework and, without any real planning, it evolved into a reimplementation of one of the presets on Korg’s Kaossilator synth toy (which I’ve enjoyed playing in the past). At one point, I was thinking of adding more Kaossilator-like features (loop recording, more synths, etc.), but interest in starting new projects instead of improving old ones won out.

The synthesis core of the app is hand written in Java. You can see an example of working with my DSP library edited down from the real source here: http://gist.github.com/376028#file_usage.java The design of the library was strongly inspired by that in ChucK, a programming language for musical livecoding that I’ve used for a few other silly projects (http://chuck.cs.princeton.edu/). Using the library, the app sets up a little modular synthesizer on startup and uses touch events to tweak parameters. It is possible for the synthesizer to be reconfigured a run-time (adding or rewiring components), but I didn’t end up using this functionality anywhere in Ethereal Dialpad. Perhaps someday I could expose the live synth construction process to users with some graphical interface — right now you have to edit the source to change the synth.

Devices like the G1 I was working with have terrible floating point performance (improved none by running code in a virtual machine!), but going ahead with the simplest solution turned out to work just fine. In another free Android app, Iteration, I used fixed-point arithmetic in C via the NDK to get the performance I wanted (http://github.com/rndmcnlly/iteration/blob/master/jni/iteration.c#L279). At one point I was having trouble with the audio stream in Ethereal Dialpad when some background processing (such as Twidroid waking up to refresh tweets) took too much processor time, but simply cutting the audio sample rate in half was an effective fix (with little effect on my output which didn’t have too much in the high frequencies at the time).

I suppose it would normally be overkill to build a synthesizer from scratch like this to get the output I did. If I knew I were really going for what Ethereal Dialpad is now from the start, I could have simply embedded a fixed set of pre-recorded tones and not mucked about with sines and cosines. One fun result of doing it the hard way is that the package you download is only 35KB (with a lot of that space dedicated to the silly icons for each dialpad). Doing as much as possible with code instead of bulk data is in line with the demoscene aesthetic which I’ve enjoyed for a long time. Generative art has long been a passion of mine, but playing with real electronic music hardware during the past few years has convinced me to try more tangible projects, exploiting the touchscreen in this case.

As an aside, there seems to be a really positive, sharing-oriented culture in the hobbyist Android programmers that I have run into. I got the idea to make Ethereal Dialpad (or at least play around with audio on Android) after seeing the Synthesizer 2 application. I could tell, just by using the application, that the developer must have been using some API for live streaming that I hadn’t noticed in the documentation yet. In response to a email to the developer I got a pointer to the exact API I was seeking, and we’ve sent Java snippets back and forth since. Another developer emailed me to figure out how my app worked and, several source-filled emails later, Ethereal Dialpad contains the “Moonblink’s Grid” dialpad, a volunteered submission.

I asked for some reflections on Android, in general, as a platform, as well, although that discussion quickly turns more generally to tools for quickly coding creative sound on computer platforms, too.

Regarding inspiring Android music apps, it was actually the (I suppose I’m qualified to say this) disappointing experience I had with Synthesizer 2 that really pushed me to think “Man, I could make something that sounds better (after I ask him how he pushed an array of floats through the speakers, that is).” After finding the right API, it was just one dusk-till-dawn hacksession before I produced CurveSlinger (http://adamsmith.as/typ0/k/CurveSlinger.apk), which is essentially the core of audio Ethereal Dialpad with no graphics. The idea of mapping both axes of the touchpad to two synths was lifted directly from the L.12 patch on the Kaossilator. I didn’t think to attempt to bolting on a pluggable GUI system for another month perhaps. Plug-ins are a whole story of their own — turns out there is a section of the Android userbase that universally ignores update notifications. [Ed.: If rumored “auto-update” features finally get baked into Market apps, I would expect that situation to improve, though it hasn’t happened yet. -PK]

In the larger context, the drive to create a synth toy from scratch was inspired by participating in the culture around livecoding languages like ChucK, Impromptu [Mac audiovisual livecoding environment], and Pd (TOPLAP is the name I feel compelled to drop here). In livecoding I can bridge the gap between the otherwise sometimes cold, engineering practice of programming and the artistic, improvisational practice of live music performance. I’m overwhemled by how easy it was to make a mini trance sequencer (http://www.youtube.com/watch?v=lVOtH5Uiatc), a tangible controller for wave playback (http://www.youtube.com/watch?v=DhDeYxhnKkY), and an infinite random claim generator (http://www.toplap.org/index.php/User:Adamsmith#.22endless_interesting_claim_generator.22http://adamsmith.as/typ0/k/voxbox/claims.html). How can I convince the general population that being a healthy consumer is not a healthy state of being and that programming is an amazingly underappreciated approach to being a creative producer? Well, I’ll hack something nifty stuff really quick and tag a note onto the app description: “Like what you feel? Consider learning to program. It’s some serious magic.”. I’ve gotten maybe 15 email responses to this last note, but it is hard to get people who have no experience into a position where they can do the same thing.

The drive to use the touchpad for something interesting draws directly from playing the Korg EMX-1 which uses a linear touch sensor to control the arpeggiator. Sure, I’ve fun with Kaossilator, but that two inch strip on the EMX-1 sucked me in for hours at a time. It was magical, and I wanted to make that kind of magic too.

I suppose I have to acknowledge the Internet at large as a major, implicit inspiration. It is impossible to remember which video here or there lead to this or that other idea. I’m sure, running your site (which I didn’t know of until you contacted me), you experience the same thing.

For your viewing pleasure, here are two of those quick audio creations. At top is a demo of livecoding in Pd (Pure Data). At bottom, in what must be a geek singularity powerful enough to actually create a depression in the fabric of space time, “a YTMND dramatic reading of some Half-Life fan fiction” with a Nintendo 64 controller and the rapid audio coding environment ChucK.

Android I think is overdue for a round-up of available audio software. (Honestly, I had put it off partly because the landscape was somewhat scarce.) Candidates so far include Sonorox, Beatpad, Uloops, Musical, and FingerPlay. Got nominees? Let us know in comments.

The “killer” apps for Android may turn out to be in-progress ports of Pd and SuperCollider. More on that topic soon; if you’re interested in contributing, or in learning more about Android music software development, you should check out the Android Music Developers Google Group.

And since so much geektastic material comes up in the interview, let Adam know if you have other questions for him.