Chapter 5. Pd for Android

Android audio development poses some unique challenges. Before you start making a musical app for Android, you have to consider the limitations of the platform. The biggest problem is latency; at the time of writing, round-trip latency for audio I/O is in the hundreds of milliseconds on all devices that I know of (fortunately, straight output latency is significantly lower). Another concern is fragmentation. The Android ecosystem has many niches, populated by a bewildering array of devices covering a wide range of OS versions, screen sizes, and input methods, frequently complicated by manufacturer-specific tweaks to the software. Audio capabilities and computing power vary widely as well, and it is not easy to discover the audio properties of a given device.

Don’t be discouraged, though. After all, libpd itself got its start as an Android project, and the open nature of Android makes it a delightful platform to develop for. The good news is that if you can live with the latency, then libpd will provide ready-made solutions or workarounds for most of the other concerns. For instance, the AudioParameters class that comes with libpd employs various tricks to get the device to reveal its audio capabilities. The PdAudio class that we already saw in Chapter 4 delegates to another class, AudioWrapper, which provides a reasonable approximation of synchronized input and output and also papers over some known, device-specific issues. If you decide that libpd is not ...

Get Making Musical Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.