Thanks to the power of unemployment freeing up my daily schedule, I was able to put a lot of work into my talk about Media Frameworks and Swift. The first version of this debuted at Forward Swift in March and was limited to 30 minutes. With an hour to fill at CocoaConf Chicago last weekend, I needed a second demo. And the obvious place for it was to stop talking about v3 Audio Units and actually write one.
Background info: audio units are self-contained modules that do something with audio. There are several distinct types: generators that produce sound (like by synthesis or playing from a file), effects that take incoming sound and change it in some way, mixers that combine multiple sources, etc. These units are available in any application that supports the audio unit standard, so they’re seen in things like Logic and GarageBand. Prior to El Capitan and iOS 9, audio units were a Mac-only technology: the closest approximation on iOS was to have some other audio unit set up a “render callback”, meaning you’d provide a pointer to your own function, to be called whenever the downstream unit wanted to pull some samples, and you’d put your audio processing code in there.
We covered using audio units in chapters 7 and 8 of the Learning Core Audio book, but didn’t actually cover creating them. We didn’t do that for a number of reasons: the documentation and base C++ class from Apple was outdated and appeared to be broken, making your own AU was Mac-only, we’d already spent two chapters on audio units, and our editor was leaving and we decided to go pencils-down and ship the damn thing. So, wouldn’t you know it, the first review on iBooks basically ripped us for not covering how to create audio units and dismissed the rest of the book as one-star garbage (and in my own defense, that’s an opinion not shared by any of the other reviews on iBooks and Amazon).
But still, it has bugged me for years that I had never actually written an audio unit of my own. So if one good thing comes from my current flirtations with insolvency, it’s that goddammit, I’m finally writing a working audio unit.
So, iBooks reviewer
whichdokta, this one’s for you. And in the immortal words of Elvis Costello, I Hope You’re Happy Now