Skip to Content
Programming iOS 12
book

Programming iOS 12

by Matt Neuburg
October 2018
Beginner content levelBeginner
1176 pages
32h 37m
English
O'Reilly Media, Inc.
Content preview from Programming iOS 12

Chapter 14. Audio

iOS provides various technologies that allow your app to produce, record, and process sound. The topic is a large one, so I’ll concentrate on the basics. You’ll want to read Apple’s Media Playback Programming Guide and Core Audio Overview in the documentation archive. Suggestions for further reading also appear at the end of this chapter.

None of the classes discussed in this chapter provides any transport interface within your app — that is, interface for allowing the user to stop and start playback of sound. If you want transport interface, here are some options:

  • You can create your own interface.

  • You can associate the built-in “remote control” buttons with your app, as I’ll explain in this chapter.

  • A web view (Chapter 11) supports the HTML5 <audio> tag; this can be a simple, lightweight way to play audio and to allow the user to control playback (including use of AirPlay).

  • You could treat the sound as a movie and use the interface-providing classes that I’ll discuss in Chapter 15; this can also be a good way to play a sound file located remotely over the internet.

System Sounds

The simplest form of sound is system sound, which is the iOS equivalent of the basic computer “beep.” This is implemented through System Sound Services, part of the Audio Toolbox framework; you’ll need to import AudioToolbox. The API for playing a system sound comes in two forms — the old form and the new form (introduced in iOS 9). I’ll show you the old form first (it still ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering iOS 12 Programming - Third Edition

Mastering iOS 12 Programming - Third Edition

Donny Wals
Programming iOS 11

Programming iOS 11

Matt Neuburg
iOS 7 Programming Cookbook

iOS 7 Programming Cookbook

Vandad Nahavandipoor
Programming iOS 13

Programming iOS 13

Matt Neuburg

Publisher Resources

ISBN: 9781492044628Errata Page