Rss

Entropy

Confession: I have no idea whether the code examples from Learning Core Audio work on El Capitan and iOS 9. Maybe? Probably most of them? But I’m in a really conflicted state with where that book is.

The book came out in early 2012, which now makes it about four years old. It took about two years off and on to write, 2010 and 2011, with a big push to wrap it up at the end of 2011 because our editor was leaving Pearson to go to Apple. Looking at my mail history, I was approached about replacing Mike Lee on the book in late 2009, so the small amount of material that he and Kevin Avila wrote probably dates back to earlier in that year.

The point of this all being, the book is old now. The stated system requirements are Xcode 4.2, Lion (Mac OS X 10.7), and iOS 5. The examples in the first few chapters that use Foundation instead of Core Foundation actually use manual retain, release and the NSAutoreleasePool because the book largely pre-dates ARC (we did finally ARC-ify those examples in the April 2014 update to the downloadable sample code, at the cost of no longer matching the written material in the book).

So now what?

The obvious question is, at what point is the Core Audio book obsolete, and at that point, what do we do? Disclosure: I haven’t talked to Pearson about this (nor looked at whether my contract with them has a right of first refusal), but a few thoughts on the matter…

  • It’s not clear that a pure Core Audio book is the right thing to have anymore – Apple has been moving more and more audio features into AV Foundation, first with the AVAudioSession and the simple player/recorder classes that wrap Audio Queue Services. Then the AVAudioEngine started offering some, but not all, of the power of Audio Units. For example, you can create a cool graph of effects, but you can only perform those effects in realtime — there’s no equivalent to AudioUnitRender() to pull samples through an offline graph (one not connected to I/O), which you’d use for performing effects on a file and writing to another file or a buffer or something.

    Yet, on the other hand, we now have Version 3 Audio Units, which can be written in Objective-C or Swift (well, at least partially), and which use an App Extension metaphor (optionally running in a separate process), which brings writing third-party audio units to iOS for the first time.

    But using this stuff means using AV Foundation, so now we’re not talking about a Core Audio book at all. It’s more like an OS X / iOS audio book that starts with the audio classes in AV Foundation, and maybe dips into the older / lower-level Audio Toolbox and related frameworks as needed.

  • It’s not clear that AV Foundation is settled either – Watching the evolution of this framework hasn’t been particularly pretty. AV Foundation has well over 100 classes, which you sort of have to mentally parse out into sub-modules that are more or less independent (the aforementioned audio queue wrappers, capture, the playback/editing classes, audio engine and units). And with the addition of the pseudo-QuickTime AVMovie, it feels like they’re not done yet. It seems like AV Foundation requires rolling with ongoing punches, not the kind of thing you want to commit to paper.

  • Y’all aren’t reading books anymore anyways – Much as I think there’s value in seeing through a topic in a cohesive, thorough way — at least for some topics — the market says otherwise. Lots of developers are happy to just learn things from Stack Overflow posts and playing connect-the-Cocoapods. Every year, fewer people buy programming books. At my local Barnes & Noble, the entire programming section has been reduced to four shelves, 3 feet across. I’m also seeing sales of my other book, iOS 9 SDK Development about a tenth of the iPhone OS 3 book (which is more attributable to the difference between a new market with huge demand and one that’s largely sated, but still…).

    And at least that’s a general-interest programming book. Niche topics like media programming always have minuscule sales. Learning Core Audio took three years to just barely outearn its advance, and my total royalties on it are equivalent to about a week and a half of contracting work. Back-of-the-envelope calculations show my hourly rate for working on the book to be below $5/hour.

OK, wow, that was a wall of text. Here, have an image so that preview-bots have something to latch on to.

charlotte-ep-9-pcm-recorder

It has nothing to do with the book, but it mentions pulse code modulation, so good enough, right?

So back to the point, it’s pretty clear to me that an update to Learning Core Audio just doesn’t make sense. Guiding someone to jump right into Audio Toolbox without fully exploring how far AV Foundation could get them would be irresponsible.

Treating this topic correctly means taking a holistic view of audio on the various Apple platforms (which brings up another point: Apple Watch has a totally different media API, and Apple TV has a subset of AV Foundation and the various Core Audio APIs). It probably is the kind of thing that a book could bring clarity to, helping the reader navigate what parts of the half-dozen or so frameworks are useful to what tasks. Yet on the other hand, there’s no realistic prospect of an adequate financial return on the work it would take to research, code, and write such a book.

…which kind of bums me out, frankly, because I appreciate how much people have gotten out of the Core Audio book, and that there’s interest in a Swift version. To that end, there’s a rather remarkable GitHub project from user AlesTsurko that has ported all the book’s sample code to Swift 2.0, with a few sticking points that could use a helpful pull request. (I think Eric Knapp also mentioned that Core MIDI with Swift was challenging)

Then again, when I hit pause a few weeks back, one thing I said I was going to do by dropping out of the conference tail-chase for a while was to take time on weekends and evenings to research and try out new stuff (that, and spend more time with my parents, after the sudden death of my brother late last year). It’s something I need to do to be an interesting developer and blogger again, because nothing at work is particularly novel or interesting. Mostly I’m focusing on streaming, but I also want to get more deeply into the new media APIs, and ideally, I’d be able to then braindump that stuff as new blog entries here, and/or gists on GitHub.

So maybe some of what would have gone into a book that didn’t make any money will instead go into this blog (where it also won’t make any money)? Maybe. Guess we’ll see how 2016 goes.

Comments (4)

  1. CW83

    Put everything in the blog is a good step forward! Another suggestion is, have you ever considered about put the update version of Core Audio Book, or OS X/iOS Audio Book(whatever name it is) as an open source project on GitHub? You can just start with a list of topics you want to talk/experiment with, and let the community help you to do the trivial stuff. And with the API/Framework changing, the book update iteration can still keep the same pace.

  2. Marcus

    Your book helped me a lot back then when it was released, so thank you for writing it. As much as I would like an updated version, I totally understand that the benefit would be rather small for you. I’d be happy to see some updates regarding these topics here on your blog!

  3. Robert

    Hi Chris, I just found you on the web while looking for audio processing in IOS.
    Then found your book about Core Audio (wich I was considering to buy!) and then this article!

    So what do you recommend to me that I’m starting to get into the audio processing field for ios and Mac OS ?

    I’m more interested in detecting patterns in audio signals in real time (not exactly text).

    Regards, Robert.

  4. Mr Adamson, I am halfway through the Core Audio book and have been diligently absorbing everything from page to page.

    I am sorry to hear that the return on the book was n’t that great, but I can’t thank you well enough for having written this book.

    Creating those first few sounds files, understanding them and their differences brought back a childlike sense of wonder and amazement.

    I started programming with GW Basic back in the days, which allows me to have a better appreciation of modern languages. I don’t know what direction Core Audio will take but I am sure that I will keep a similar appreciation no matter how well the modern APIs evolve.

    Thank you, Sir!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.