< Previous PageNext Page > Hide TOC

CAF File Overview

This chapter provides background information important for understanding and using Apple’s Core Audio Format (CAF) files.

In this section:

CAF File Advantages
CAF File Structure
Types of Chunks


CAF File Advantages

Apple’s Core Audio Format is a flexible, state-of-the-art file format for storing and manipulating digital audio data. It is fully supported by Core Audio APIs on Mac OS X v10.4 and later and on Mac OS X v10.3 with QuickTime 7 or later. CAF provides high performance and flexibility, and is scalable to future ultra-high resolution audio recording, editing, and playback.

CAF files have several advantages over other standard audio file formats:

CAF File Structure

CAF files begin with a file header, which identifies the file type and the CAF version, followed by a series of chunks. A chunk consists of a header, which defines the type of the chunk and indicates the size of its data section, followed by the chunk data. The nature and format of the data is specific to each type of chunk.

The only two chunk types required for every CAF file are the Audio Data chunk (which, as you might have guessed, contains the audio data) and the Audio Description chunk, which specifies the audio data format.

The Audio Description chunk must be the first chunk following the file header. The Audio Data chunk can appear anywhere else in the file, unless the size of its data section has not been determined. In that case, the size field in the Audio Data chunk header is set to -1 and the Audio Data chunk must come last in the file so that the end of the audio data chunk is the same as the end of the file. This placement allows you to determine the data section size when that information is not available in the size field.

Audio is stored in the Audio Data chunk as a sequential series of packets. An audio packet in a CAF file contains one or more frames of audio data.

CAF supports a wide range of other chunk types, which can be placed in any order in the file except first (reserved for the Audio Description chunk) or last (when the Audio Data chunk size field is set to -1). Some chunk types can be used more than once in a file. Some refer to—or are referred to by—chunks of other types.

Chunk Structure

Every chunk consists of a chunk header followed by a data section. Chunk headers contain two fields:

The format of the data in a chunk depends on the chunk type. It consists of a series of sections, typically called fields. The format of the audio data depends on the data type. All of the other fields in a CAF file are in big-endian (network) byte order.

Packets, Frames, and Samples

In order to understand this specification, it is important to understand the definitions of the following four terms:

Types of Chunks

This section briefly introduces the types of chunks defined in the CAF specification. All CAF chunk types are fully described in “Core Audio Format Specification.”

Required

Every CAF file must include the following chunks:

Channel Layout

There is one chunk that is required for all CAF files with more than two channels:

Supplementary Data

Some chunks refer to data in other, supporting chunks:

Markers

There are two chunks that you can use to place markers in the data file. These chunks share data types, described in “Marker Data Types”:

Music Metadata

There are two chunk types that store musical information:

Support For Editors

Two chunks contain data for use by audio editors:

Annotations

There are two chunk types that hold annotations to the data:

Identifier

One chunk type can be used to uniquely identify the data:

Extending CAF

You can define your own chunk type to extend the CAF file specification. There is a chunk type defined for this purpose:

Extra Space

Many chunk types allow you to specify a larger chunk size than is currently needed for data in order to reserve additional space. There is also a special chunk you can use to reserve extra space in the CAF file as a whole:



< Previous PageNext Page > Hide TOC


© 2005, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-03-08)


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.