Getting Started with Audio

Technology Overview

Core Audio provides world-class support for adding audio features to your application, scaling to meet a wide range of needs:

  • Recording, playback, or synchronization

  • Parsing streamed audio

  • Filtering, effects, or synthesis

  • MIDI interfacing, playback, or control

  • User-interface sounds

  • Surround sound for games development

  • Professional-grade digital audio workstation development

The Core Audio architecture in Mac OS X includes a wide range of application-level services. These services cooperate with the underlying technology layers, exposing features you need while taking care of low-level complexities.


image: Art/core_audio_architecture.jpg

You may also want to learn about the audio capabilities provided by QuickTime, particularly for cross-platform development, as described in Getting Started with QuickTime.

Start Here

Before you develop an application that uses Mac OS X audio technologies, become familiar with them by reading:

  • Core Audio Overview to learn about the features, programming interfaces, and architecture of Core Audio

  • The Audio topic page to become familiar with the latest developments in the Core Audio APIs, documentation, and technical notes

  • The Core Audio SDK to view sample code and starting points for many projects

Choose a Learning Path

You select among the various Mac OS X audio APIs based on your development language and on the needs of your application.

Playing and Synchronizing Audio

If you are a Carbon, Cocoa, or UNIX developer creating an application for Mac OS X v10.5 or later, use Audio Queue Services for audio playback and synchronization. Read Audio Queue Services Programming Guide to learn how to use this technology.

To support previous versions of Mac OS X, use QuickTime for basic audio playback. Consult QuickTime Audio.

If you are developing a Cocoa application that needs to play only uncompressed audio data, read Sound Programming Topics for Cocoa.

Recording Audio

To add recording capability to any application for Mac OS X v10.5 or later, use Audio Queue Services. Read Audio Queue Services Programming Guide to learn how to record linear PCM or compressed audio.

To support previous versions of Mac OS X, use the interfaces in the Audio File and Converter Services framework, as described in Core Audio Overview.

Parsing Streamed Audio

To parse an audio file stream, use Audio File Stream Services, part of the Audio Toolbox framework. Read Audio File Stream Services Reference and Audio File Services Reference, which describe the C interfaces you need. Audio File Stream Services is available in Mac OS X v10.5 and later.

Adding Digital Signal Processing or Audio Synthesis

To add flexible digital signal processing or MIDI-controlled audio synthesis to an application, use audio units. Audio units are plug-ins that let you provide enhancements to applications such as Logic Pro and GarageBand. You can also use audio units to build audio features into your own application.

With audio units, you can develop effects such as filtering and reverb, MIDI-based music synthesis, audio data format conversions, mixing, panning, sound generation and playback, and more. Read Audio Unit Programming Guide, which provides conceptual information and a tutorial.

The Core Audio SDK includes a variety of Xcode projects to get you started. If you are targeting your audio unit for use in an Apple Pro application such as Logic Pro, review Audio Unit Developer Guidelines (PDF) for tips and best practices information.

Supporting MIDI

If you plan to support MIDI interfacing, to play MIDI data, or to record incoming MIDI data, read Core MIDI Services and MIDI Server Services in Core Audio Overview. Look at MIDI File Format to learn how to use MIDI data in QuickTime.

Supporting Surround Sound

If you want to perform spatial manipulation of sound in your application, especially if you are a games developer, use the Mac OS X OpenAL framework. Learn more about OpenAL on the OpenAL website.

Starting in Mac OS X v10.5, the AU Lab application (Apple’s reference audio unit host) supports surround sound. AU Lab is included with Xcode Tools, available on the Mac OS X installation DVD. Mac OS X v10.5 also includes a set of surround-sound enabled “panner” audio units. Use these facilities for working with and testing surround sound.

Playing Alerts and User Interface Sounds

If you are a Carbon, Cocoa, or UNIX developer creating an application for Mac OS X v10.5 or later, use the interfaces in the AudioServices.h header file in the Audio Toolbox framework to play alerts and user interface sounds.

For earlier versions of Mac OS X, use the interfaces in the SystemSounds.h header file in the OS Services framework for user interface sounds. Read Technical Note TN2102, The System Sound APIs for Mac OS X 10.2, 10.3 and later, to learn how to play system sounds in Mac OS X v10.4 and earlier.

Supporting Audio Hardware and Disc Recording

If you are a hardware vendor, you may need to supply drivers to allow your product to interact with Mac OS X applications. Core Audio supports driver development. Consult Audio Device Driver Programming Guide to learn how to develop drivers for Mac OS X. You may also want to read Getting Started with Hardware and Drivers.

If your application offers disc recording capability, refer to Disc Recording Framework Reference and Disc Recording UI Framework Reference for comprehensive descriptions of these interfaces.

Next Steps

The Audio Reference Library includes the following resource pages, which can be bookmarked for easy access:

  • Guides

    Conceptual and how-to information for audio technologies.

  • Reference

    Focused, detailed descriptions in reference format for audio technologies.

  • Release Notes

    Various notes about audio technologies and SDKs.

  • Sample Code

    Sample applications demonstrating a variety of audio technologies. If you have installed the Core Audio SDK, available as part of Xcode Tools, you can find sample projects in /Developer/Examples/CoreAudio.

  • Technical Notes

    Late-breaking documents on issues related to audio technologies.

  • Technical Q&As

    Programming tips, code snippets, & FAQs by Apple’s support engineers.

  • Mailing Lists

    The Core Audio mailing list (coreaudio-api) is an excellent place to discuss issues or topics with fellow developers using Core Audio, OpenAL, and MIDI APIs in Mac OS X.



© 2004, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.