Learning Core Audio
A Hands-On Guide to Audio Programming for Mac and iOS
Chris Adamson
Kevin Avila
Upper Saddle River, NJ Boston Indianapolis San Francisco
New York Toronto Montreal London Munich Paris Madrid
Cape Town Sydney Tokyo Singapore Mexico City
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact:
U.S. Corporate and Government Sales
(800) 382-3419
For sales outside the United States, please contact:
International Sales
Visit us on the Web: informit.com/aw
Library of Congress Cataloging-in-Publication Data
Adamson, Chris, 1967
Learning Core audio : a hands-on guide to audio programming for Mac and iOS / Chris
Adamson, Kevin Avila.
p. cm.
ISBN 978-0-321-63684-3 (pbk. : alk. paper) ISBN 0-321-63684-8 (pbk. : alk. paper)
1. Computer sound processingComputer programs. 2. Core audio. 3. Apple computer
Programming. I. Avila, Kevin, 1980- II. Title.
TK7881.4.A244 2012
006.45dc23
2012000862
Copyright 2012 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-32-163684-3
ISBN-10: 0-32-163684-8
Text printed in the United States on recycled paper at R.R. Donnelley in Crawfordsville, Indiana.
Second printing, June 2012
Editor-in-Chief
Mark Taub
Senior Acquisitions Editor
Trina MacDonald
Development Editor
Chris Zahn
Managing Editor
Kristy Hart
Senior Project Editor
Lori Lyons
Copy Editor
Krista Hansing Editorial Services, Inc.
Senior Indexer
Cheryl Lenser
Proofreader
Kathy Ruiz
Technical Reviewers
Mark Dalrymple
Mark Granoff
Michael James
Chris Liscio
Robert Strogan
Alex Wiltschko
Publishing Coordinator
Olivia Basegio
Multimedia Developer
Dan Scherf
Cover Designer
Chuti Prasertsith
Compositor
Nonie Ratcliff
Acknowledgments
From Chris Adamson
This book wouldnt exist without Kevin Avila and Mike Lee, who found a publisher who not only wasnt scared off by the thought of a difficult niche Mac and iOS title, but actually relished the challenge of bringing this beast to market. They knew there was a crowd out there that has been aching for years to get Core Audio presented in a practical form that lets normal programmers draw out its ferocious power. Behind the scenes, Chuck Toporek championed this book, pulled me in when it got stuck, and saw it through to the finish. More than anyone else, hes the one to thank for finally getting a Core Audio book published.
We wouldnt have been able to get it all done without the generous support of the Core Audio developer community, particularly the membership of the coreaudio-api
mailing list. Core Audio founder William Stewart and Apples Doug Wyatt have long been generous with their time and attention to questions posted to the list and got us unstuck on a number of occasions.
Were also grateful to our many tech reviewers and readers of the Rough Cuts edition who reported errors and provided feedback as this book worked through its long road to completion.
At home, thanks to my wife, Kelly, and our kids, Keagan and Quinn, for cutting me enough slack to get this thing done and not completely freaking out when the example code went wrong and horrible buzzes blasted forth from Dads office in the basement.
Obligatory end-of-book tune check: This time it was We Are The City, ... And You Will Know Us by the Trail of Dead, Daft Punk, Dr. Dog, Fun, and (fittingly) Hatsune Miku.
From Kevin Avila
I would like to acknowledge the Big Bang, gravity, and the eventual copulation between my parents for making this possible.
Chuck Toporek (@chuckdude), Chris Adamson (@invalidname), Mike Lee (@bmf): There truly are no words that express my gratitude for all the blood, sweat, and grammar youve contributed, not only to this book, but to the entire developer community. Thank you.
Bill Stewart, Jeff Moore, Doug Wyatt, Michael Hopkins, Bob Aron, James McCartney, Mehul Trivedi, Cynthia Maxwell, Torrey Walker, Nick Thompson, Matthew Mora, Brad Ford, Murray Jason, and Edward Agabeg: Thanks for sharing with me your passion and knowledge of audio.
Special thanks to David Avila, Daniel Kaufman, Andre LaBranche, Quentin Carnicelli, Ed Wynne, and Steve Jobs.
Whats on my iPod: AC/DC, Rush, Beach Boys, Sublime, Primus, KRS-One, Beastie Boys, Mac Dre, Vokab Kompany, and the insanely great George Carlin.
About the Authors
Chris Adamson is an independent writer, editor, and developer who lives in Grand Rapids, Michigan. Now focusing on iOS and Mac development, he is the coauthor of iOS SDK Development (Pragmatic Programmers, 2012). He is also the author of QuickTime for Java: A Developers Notebook (OReilly Media, 2005) and coauthor of Swing Hacks (OReilly Media, 2005). He was formerly the editor of java.net and ONJava.com. He consults and publishes through his corporate identity, Subsequently and Furthermore, Inc., with a focus on user-facing and digital media development for Mac and iOS. He blogs on digital media software development at www.subfurther.com/blog. In a previous career, he was a writer/associate producer at CNN Headline News, and over the years, he has managed to own 11 1/2 Macs.
Kevin Avila (a.k.a. dogbert) is a smooth blend of carbon compounds, oxygen, hydrogen, and nitrogen, with some impurities for added flavor. Additionally, he has more than 15 years experience developing for the Mac and, since its release, the iPhone. Kevin has been involved in every corner of the audio market, from being an engineer at Apple to configuring professional recording studios. He currently is a code mercenary for various clients while he sits in his underwear at home, sipping coffee.
Wed Like to Hear from You
You can visit our website and register this book at: